Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
22 changes: 12 additions & 10 deletions doc/api/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,30 +598,32 @@ This variable may appear to be global but is not. See [`module`][].

<!-- YAML
added: v21.0.0
changes:
version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/50412
description: The API is behind the CLI flag `--experimental-global-navigator`.
-->

> Stability: 1.1 - Active development
> Stability: 1.1 - Active development. Use `--experimental-global-navigator` to
> enable this feature.

A partial implementation of the [Navigator API][].

## `navigator`

<!-- YAML
added: v21.0.0
changes:
version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/50412
description: The API is behind the CLI flag `--experimental-global-navigator`.
-->

> Stability: 1.1 - Active development
> Stability: 1.1 - Active development. Use `--experimental-global-navigator` to
> enable this feature.

A partial implementation of [`window.navigator`][].

If your app or a dependency uses a check for `navigator` to determine whether it
is running in a browser, the following can be used to delete the `navigator`
global before app code runs:

```bash
node --import 'data:text/javascript,delete globalThis.navigator' app.js
```

### `navigator.hardwareConcurrency`

<!-- YAML
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ builtinModules.forEach((moduleName) => {
'structuredClone',
'fetch',
'crypto',
'navigator',
];
assert.deepStrictEqual(new Set(Object.keys(global)), new Set(expected));
}
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-navigator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Flags: --experimental-global-navigator
'use strict';

require('../common');
Expand Down