lib: move web global bootstrapping to the expected file
PR-URL: https://github.com/nodejs/node/pull/47881 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe>
This commit is contained in:
parent
f3b713d187
commit
77df1d84c7
@ -70,7 +70,6 @@ const internalTimers = require('internal/timers');
|
|||||||
const {
|
const {
|
||||||
defineOperation,
|
defineOperation,
|
||||||
deprecate,
|
deprecate,
|
||||||
defineLazyProperties,
|
|
||||||
} = require('internal/util');
|
} = require('internal/util');
|
||||||
const {
|
const {
|
||||||
validateInteger,
|
validateInteger,
|
||||||
@ -208,22 +207,12 @@ internalBinding('async_wrap').setupHooks(nativeHooks);
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
setupTaskQueue,
|
setupTaskQueue,
|
||||||
queueMicrotask,
|
|
||||||
} = require('internal/process/task_queues');
|
} = require('internal/process/task_queues');
|
||||||
|
|
||||||
// Non-standard extensions:
|
|
||||||
defineOperation(globalThis, 'queueMicrotask', queueMicrotask);
|
|
||||||
|
|
||||||
const timers = require('timers');
|
const timers = require('timers');
|
||||||
|
// Non-standard extensions:
|
||||||
defineOperation(globalThis, 'clearImmediate', timers.clearImmediate);
|
defineOperation(globalThis, 'clearImmediate', timers.clearImmediate);
|
||||||
defineOperation(globalThis, 'setImmediate', timers.setImmediate);
|
defineOperation(globalThis, 'setImmediate', timers.setImmediate);
|
||||||
|
|
||||||
defineLazyProperties(
|
|
||||||
globalThis,
|
|
||||||
'internal/structured_clone',
|
|
||||||
['structuredClone'],
|
|
||||||
);
|
|
||||||
|
|
||||||
// Set the per-Environment callback that will be called
|
// Set the per-Environment callback that will be called
|
||||||
// when the TrackingTraceStateObserver updates trace state.
|
// when the TrackingTraceStateObserver updates trace state.
|
||||||
// Note that when NODE_USE_V8_PLATFORM is true, the observer is
|
// Note that when NODE_USE_V8_PLATFORM is true, the observer is
|
||||||
|
@ -26,12 +26,23 @@ defineOperation(globalThis, 'clearTimeout', timers.clearTimeout);
|
|||||||
defineOperation(globalThis, 'setInterval', timers.setInterval);
|
defineOperation(globalThis, 'setInterval', timers.setInterval);
|
||||||
defineOperation(globalThis, 'setTimeout', timers.setTimeout);
|
defineOperation(globalThis, 'setTimeout', timers.setTimeout);
|
||||||
|
|
||||||
|
const {
|
||||||
|
queueMicrotask,
|
||||||
|
} = require('internal/process/task_queues');
|
||||||
|
defineOperation(globalThis, 'queueMicrotask', queueMicrotask);
|
||||||
|
|
||||||
|
defineLazyProperties(
|
||||||
|
globalThis,
|
||||||
|
'internal/structured_clone',
|
||||||
|
['structuredClone'],
|
||||||
|
);
|
||||||
|
defineLazyProperties(globalThis, 'buffer', ['atob', 'btoa']);
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/web-messaging.html#broadcasting-to-other-browsing-contexts
|
// https://html.spec.whatwg.org/multipage/web-messaging.html#broadcasting-to-other-browsing-contexts
|
||||||
exposeLazyInterfaces(globalThis, 'internal/worker/io', ['BroadcastChannel']);
|
exposeLazyInterfaces(globalThis, 'internal/worker/io', ['BroadcastChannel']);
|
||||||
exposeLazyInterfaces(globalThis, 'internal/worker/io', [
|
exposeLazyInterfaces(globalThis, 'internal/worker/io', [
|
||||||
'MessageChannel', 'MessagePort', 'MessageEvent',
|
'MessageChannel', 'MessagePort', 'MessageEvent',
|
||||||
]);
|
]);
|
||||||
defineLazyProperties(globalThis, 'buffer', ['atob', 'btoa']);
|
|
||||||
// https://www.w3.org/TR/FileAPI/#dfn-Blob
|
// https://www.w3.org/TR/FileAPI/#dfn-Blob
|
||||||
exposeLazyInterfaces(globalThis, 'internal/blob', ['Blob']);
|
exposeLazyInterfaces(globalThis, 'internal/blob', ['Blob']);
|
||||||
// https://www.w3.org/TR/FileAPI/#dfn-file
|
// https://www.w3.org/TR/FileAPI/#dfn-file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user