diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index c40c955ab29227..2814b7228aa2c1 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -70,7 +70,6 @@ const internalTimers = require('internal/timers'); const { defineOperation, deprecate, - defineLazyProperties, } = require('internal/util'); const { validateInteger, @@ -208,22 +207,12 @@ internalBinding('async_wrap').setupHooks(nativeHooks); const { setupTaskQueue, - queueMicrotask, } = require('internal/process/task_queues'); - -// Non-standard extensions: -defineOperation(globalThis, 'queueMicrotask', queueMicrotask); - const timers = require('timers'); +// Non-standard extensions: defineOperation(globalThis, 'clearImmediate', timers.clearImmediate); defineOperation(globalThis, 'setImmediate', timers.setImmediate); -defineLazyProperties( - globalThis, - 'internal/structured_clone', - ['structuredClone'], -); - // Set the per-Environment callback that will be called // when the TrackingTraceStateObserver updates trace state. // Note that when NODE_USE_V8_PLATFORM is true, the observer is diff --git a/lib/internal/bootstrap/web/exposed-window-or-worker.js b/lib/internal/bootstrap/web/exposed-window-or-worker.js index 01c88c9679dfc0..8dc77493e1f152 100644 --- a/lib/internal/bootstrap/web/exposed-window-or-worker.js +++ b/lib/internal/bootstrap/web/exposed-window-or-worker.js @@ -26,12 +26,23 @@ defineOperation(globalThis, 'clearTimeout', timers.clearTimeout); defineOperation(globalThis, 'setInterval', timers.setInterval); 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 exposeLazyInterfaces(globalThis, 'internal/worker/io', ['BroadcastChannel']); exposeLazyInterfaces(globalThis, 'internal/worker/io', [ 'MessageChannel', 'MessagePort', 'MessageEvent', ]); -defineLazyProperties(globalThis, 'buffer', ['atob', 'btoa']); // https://www.w3.org/TR/FileAPI/#dfn-Blob exposeLazyInterfaces(globalThis, 'internal/blob', ['Blob']); // https://www.w3.org/TR/FileAPI/#dfn-file