-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SharedArrayBuffer to Buffer documentation #15489
Conversation
doc/api/buffer.md
Outdated
@@ -2702,6 +2703,7 @@ This value may depend on the JS engine that is being used. | |||
|
|||
[`ArrayBuffer#slice()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/slice | |||
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | |||
[`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please move this line to keep the alphabetical order?
Done. I can rebase the commits if you prefer. |
No, it's fine, commits are squashed before landing. Thank you. |
doc/api/buffer.md
Outdated
@@ -361,16 +361,16 @@ changes: | |||
> [`Buffer.from(arrayBuffer[, byteOffset [, length]])`][`Buffer.from(arrayBuffer)`] | |||
> instead. | |||
|
|||
* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a | |||
[`TypedArray`]. | |||
* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`], [`SharedArrayBuffer`] or the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change {ArrayBuffer}
to {ArrayBuffer|SharedArrayBuffer}
as well?
When `string` is a `Buffer`/[`DataView`]/[`TypedArray`]/[`ArrayBuffer`], the | ||
actual byte length is returned. | ||
When `string` is a `Buffer`/[`DataView`]/[`TypedArray`]/[`ArrayBuffer`]/ | ||
[`SharedArrayBuffer`], the actual byte length is returned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
doc/api/buffer.md
Outdated
* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a | ||
[`TypedArray`]. | ||
* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`], [`SharedArrayBuffer`], or the | ||
`.buffer` property of a [`TypedArray`]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with the comments addressed.
I've addressed the comments. |
doc/api/buffer.md
Outdated
@@ -807,8 +807,8 @@ A `TypeError` will be thrown if `array` is not an `Array`. | |||
added: v5.10.0 | |||
--> | |||
|
|||
* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a | |||
[`TypedArray`]. | |||
* `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An [`ArrayBuffer`], [`SharedArrayBuffer`], or the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line length is above 80 chars.
doc/api/buffer.md
Outdated
@@ -679,7 +679,7 @@ changes: | |||
or `ArrayBuffer`. | |||
--> | |||
|
|||
* `string` {string|Buffer|TypedArray|DataView|ArrayBuffer} A value to | |||
* `string` {string|Buffer|TypedArray|DataView|ArrayBuffer|SharedArrayBuffer} A value to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line length is above 80 chars.
doc/api/buffer.md
Outdated
@@ -361,16 +361,16 @@ changes: | |||
> [`Buffer.from(arrayBuffer[, byteOffset [, length]])`][`Buffer.from(arrayBuffer)`] | |||
> instead. | |||
|
|||
* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a | |||
[`TypedArray`]. | |||
* `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An [`ArrayBuffer`], [`SharedArrayBuffer`] or the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line length is above 80 chars.
Ping @ThomasdenH this needs a rebase and please address the comments about the line length. |
@ThomasdenH ... can I ask you to please squash the commits down into a single commit |
Linter CI after rebase and squash: https://ci.nodejs.org/job/node-test-linter/13860/ Edit: CI timed out. New try: https://ci.nodejs.org/job/node-test-linter/13861/ |
Landed in bd0e36d |
PR-URL: #15489 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: #15489 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: #15489 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: #15489 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: #15489 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: #15489 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Since 2a2ec9d,
Buffer
accepts aSharedArrayBuffer
in places whereArrayBuffer
was accepted previously. This PR updates the documentation accordingly.Note that not every occurrence was replaced. In most cases it seems clear from the context that both are accepted, although some might disagree about this.
make -j4 test
(UNIX), orvcbuild test
(Windows) passes