Skip to content
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

doc: add more details for localStorage and sessionStorage #53881

Merged
merged 27 commits into from
Sep 20, 2024
Merged
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
04058ef
doc: add more details for localStorage and sessionStorage
Rekl0w Jul 17, 2024
5a26e30
doc: update details for `localstorage`
Rekl0w Jul 17, 2024
bb43e89
doc: update `localStorage` and `sessionStorage`
Rekl0w Jul 17, 2024
a16e2b7
doc: remove browser infos from `localStorage` and `sessionStorage`
Rekl0w Jul 17, 2024
071dd6b
Update doc/api/globals.md
Rekl0w Jul 17, 2024
10aae0f
Update doc/api/globals.md
Rekl0w Jul 17, 2024
e67044c
Update doc/api/globals.md
Rekl0w Jul 18, 2024
ff8d3e0
doc: revert `simultaneously`
Rekl0w Jul 18, 2024
034d00e
doc: update `localStorage` and `sessionStorage`
Rekl0w Jul 18, 2024
0f5357b
doc: lint fix
Rekl0w Aug 15, 2024
1c1e024
Update doc/api/globals.md
Rekl0w Aug 21, 2024
ba117c2
Update doc/api/globals.md
Rekl0w Aug 21, 2024
77fc563
Update doc/api/globals.md
Rekl0w Aug 21, 2024
314a62f
Update doc/api/globals.md
Rekl0w Aug 21, 2024
1bb4f50
Update doc/api/globals.md
Rekl0w Aug 21, 2024
8c2da93
Update doc/api/globals.md
Rekl0w Aug 21, 2024
683ee9f
Update doc/api/globals.md
Rekl0w Aug 21, 2024
5d6e9b6
Update doc/api/globals.md
Rekl0w Aug 21, 2024
7b497da
Update doc/api/globals.md
Rekl0w Aug 21, 2024
43ae345
Update doc/api/globals.md
Rekl0w Aug 21, 2024
58977b7
Update doc/api/globals.md
Rekl0w Aug 23, 2024
bb2275c
doc: re-add `webassembly-org`
Rekl0w Aug 23, 2024
a03e286
doc: fix `single session` to `single context`
Rekl0w Aug 23, 2024
8bae3e7
Revert "doc: fix `single session` to `single context`"
Rekl0w Aug 23, 2024
9c06414
Update globals.md
Rekl0w Aug 23, 2024
7c3ead3
Update globals.md
Rekl0w Aug 26, 2024
20cf144
Update doc/api/globals.md
cjihrig Aug 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 31 additions & 17 deletions doc/api/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ The API is based on the Web API [`AbortController`][].
```js
const ac = new AbortController();

ac.signal.addEventListener('abort', () => console.log('Aborted!'),
{ once: true });
ac.signal.addEventListener("abort", () => console.log("Aborted!"), {
once: true,
});
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved

ac.abort();

console.log(ac.signal.aborted); // Prints true
console.log(ac.signal.aborted); // Prints true
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved
```

### `abortController.abort([reason])`
Expand Down Expand Up @@ -152,12 +153,16 @@ single `type` property set to `'abort'`:
const ac = new AbortController();

// Use either the onabort property...
ac.signal.onabort = () => console.log('aborted!');
ac.signal.onabort = () => console.log("aborted!");
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved

// Or the EventTarget API...
ac.signal.addEventListener('abort', (event) => {
console.log(event.type); // Prints 'abort'
}, { once: true });
ac.signal.addEventListener(
"abort",
(event) => {
console.log(event.type); // Prints 'abort'
},
{ once: true }
);
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved

ac.abort();
```
Expand Down Expand Up @@ -210,8 +215,8 @@ An optional reason specified when the `AbortSignal` was triggered.

```js
const ac = new AbortController();
ac.abort(new Error('boom!'));
console.log(ac.signal.reason); // Error: boom!
ac.abort(new Error("boom!"));
console.log(ac.signal.reason); // Error: boom!
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved
```

#### `abortSignal.throwIfAborted()`
Expand Down Expand Up @@ -592,8 +597,11 @@ added: v22.4.0

A browser-compatible implementation of [`localStorage`][]. Data is stored
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved
unencrypted in the file specified by the [`--localstorage-file`][] CLI flag.
The maximum amount of data that can be stored is 10 MB.
Any modification of this data outside of the Web Storage API is not supported.
Enable this API with the [`--experimental-webstorage`][] CLI flag.
`localStorage` data is not stored per user or per request when used in the context
of a server, it is shared across all users and requests.
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved

## `MessageChannel`

Expand Down Expand Up @@ -663,7 +671,9 @@ The `navigator.hardwareConcurrency` read-only property returns the number of
logical processors available to the current Node.js instance.

```js
console.log(`This process is running on ${navigator.hardwareConcurrency} logical processors`);
console.log(
`This process is running on ${navigator.hardwareConcurrency} logical processors`
);
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved
```

### `navigator.language`
Expand All @@ -684,7 +694,9 @@ The value is representing the language version as defined in [RFC 5646][].
The fallback value on builds without ICU is `'en-US'`.

```js
console.log(`The preferred language of the Node.js instance has the tag '${navigator.language}'`);
console.log(
`The preferred language of the Node.js instance has the tag '${navigator.language}'`
);
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved
```

### `navigator.languages`
Expand Down Expand Up @@ -848,14 +860,14 @@ DataHandler.prototype.load = async function load(key) {
const hit = this._cache.get(key);
if (hit !== undefined) {
queueMicrotask(() => {
this.emit('load', hit);
this.emit("load", hit);
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved
});
return;
}

const data = await fetchData(key);
this._cache.set(key, data);
this.emit('load', data);
this.emit("load", data);
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved
};
```

Expand Down Expand Up @@ -972,9 +984,11 @@ added: v22.4.0
> Stability: 1.0 - Early development.

A browser-compatible implementation of [`sessionStorage`][]. Data is stored in
memory, with a storage quota of 10 MB. Any modification of this data outside of
the Web Storage API is not supported. Enable this API with the
[`--experimental-webstorage`][] CLI flag.
memory, with a storage quota of 10 MB. `sessionStorage` data persists only within
the currently running process, and is not shared between workers.
[`--experimental-webstorage`][] CLI flag. `sessionStorage` data is not stored per
user or per request when used in the context of a server, it is specific to
a single session.
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved

## `setImmediate(callback[, ...args])`

Expand Down Expand Up @@ -1274,4 +1288,4 @@ A browser-compatible implementation of [`WritableStreamDefaultWriter`][].
[built-in objects]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
[timers]: timers.md
[webassembly-mdn]: https://developer.mozilla.org/en-US/docs/WebAssembly
[webassembly-org]: https://webassembly.org
[webassembly-org]: https://webassembly.org
Rekl0w marked this conversation as resolved.
Show resolved Hide resolved