-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
46 additions
and
33 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
files/zh-cn/web/javascript/reference/global_objects/arraybuffer/resizable/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
title: ArrayBuffer.prototype.resizable | ||
slug: Web/JavaScript/Reference/Global_Objects/ArrayBuffer/resizable | ||
--- | ||
|
||
{{JSRef}} | ||
|
||
{{jsxref("ArrayBuffer")}} 实例的 **`resizable`** 访问器属性返回此数组缓冲区是否可以调整大小。 | ||
|
||
{{EmbedInteractiveExample("pages/js/arraybuffer-resizable.html")}} | ||
|
||
## 描述 | ||
|
||
`resizable` 是一个访问器属性,其 set 访问器函数是 `undefined`,这意味着你只能读取该属性。该属性的值在数组创建时就确定了。如果在构造函数中设置了 `maxByteLength` 选项,`resizable` 将返回 `true`;否则,它将返回 `false`。 | ||
|
||
## 示例 | ||
|
||
### 使用 resizable | ||
|
||
在这个示例中,我们创建了一个 8 字节缓冲区,该缓冲区可调整到的最大长度为 16 字节,然后检查它的 `resizable` 属性,如果 `resizable` 返回 `true` 则调整它的大小: | ||
|
||
```js | ||
const buffer = new ArrayBuffer(8, { maxByteLength: 16 }); | ||
|
||
if (buffer.resizable) { | ||
console.log("缓冲区可以调整大小!"); | ||
buffer.resize(12); | ||
} | ||
``` | ||
|
||
## 规范 | ||
|
||
{{Specifications}} | ||
|
||
## 浏览器兼容性 | ||
|
||
{{Compat}} | ||
|
||
## 参见 | ||
|
||
- {{jsxref("ArrayBuffer")}} | ||
- {{jsxref("ArrayBuffer.prototype.maxByteLength")}} | ||
- {{jsxref("ArrayBuffer.prototype.resize()")}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -339,15 +339,6 @@ front-matter@^4.0.2: | |
dependencies: | ||
js-yaml "^3.13.1" | ||
|
||
fs-extra@^11.1.1: | ||
version "11.1.1" | ||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.1.1.tgz#da69f7c39f3b002378b0954bb6ae7efdc0876e2d" | ||
integrity sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ== | ||
dependencies: | ||
graceful-fs "^4.2.0" | ||
jsonfile "^6.0.1" | ||
universalify "^2.0.0" | ||
|
||
fs.realpath@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" | ||
|
@@ -393,11 +384,6 @@ [email protected]: | |
merge2 "^1.4.1" | ||
slash "^4.0.0" | ||
|
||
graceful-fs@^4.1.6, graceful-fs@^4.2.0: | ||
version "4.2.11" | ||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" | ||
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== | ||
|
||
human-signals@^5.0.0: | ||
version "5.0.0" | ||
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28" | ||
|
@@ -486,15 +472,6 @@ js-yaml@^3.13.1: | |
argparse "^1.0.7" | ||
esprima "^4.0.0" | ||
|
||
jsonfile@^6.0.1: | ||
version "6.1.0" | ||
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" | ||
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== | ||
dependencies: | ||
universalify "^2.0.0" | ||
optionalDependencies: | ||
graceful-fs "^4.1.6" | ||
|
||
[email protected]: | ||
version "2.1.0" | ||
resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" | ||
|
@@ -1184,11 +1161,6 @@ unist-util-visit@^5.0.0: | |
unist-util-is "^6.0.0" | ||
unist-util-visit-parents "^6.0.0" | ||
|
||
universalify@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" | ||
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== | ||
|
||
util-deprecate@^1.0.1: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" | ||
|