From 9f1282d536dc8f0a11714980b4b78ee0b979e1de Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Sun, 20 Jan 2019 10:25:15 -0600 Subject: [PATCH] lib: move queueMicrotask to stable PR-URL: https://github.com/nodejs/node/pull/25594 Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Yuta Hiroto --- doc/api/globals.md | 2 -- lib/internal/bootstrap/node.js | 28 +++++----------------------- test/common/index.js | 3 ++- test/parallel/test-global.js | 1 + 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/doc/api/globals.md b/doc/api/globals.md index 65b9ad01b21979..7d1cc415bf8dbf 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -114,8 +114,6 @@ added: v11.0.0 -> Stability: 1 - Experimental - * `callback` {Function} Function to be queued. The `queueMicrotask()` method queues a microtask to invoke `callback`. If diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 9b13d326c21e06..83e1507441be28 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -396,30 +396,12 @@ function createGlobalConsole(consoleFromVM) { } function setupQueueMicrotask() { + const { queueMicrotask } = + NativeModule.require('internal/queue_microtask'); Object.defineProperty(global, 'queueMicrotask', { - get() { - process.emitWarning('queueMicrotask() is experimental.', - 'ExperimentalWarning'); - const { queueMicrotask } = - NativeModule.require('internal/queue_microtask'); - - Object.defineProperty(global, 'queueMicrotask', { - value: queueMicrotask, - writable: true, - enumerable: false, - configurable: true, - }); - return queueMicrotask; - }, - set(v) { - Object.defineProperty(global, 'queueMicrotask', { - value: v, - writable: true, - enumerable: false, - configurable: true, - }); - }, - enumerable: false, + value: queueMicrotask, + writable: true, + enumerable: true, configurable: true, }); } diff --git a/test/common/index.js b/test/common/index.js index 084f82b115b7ba..ee12b641dde48e 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -258,7 +258,8 @@ let knownGlobals = [ global, setImmediate, setInterval, - setTimeout + setTimeout, + queueMicrotask, ]; if (global.gc) { diff --git a/test/parallel/test-global.js b/test/parallel/test-global.js index e8112531fc7f2c..dd3f37ee93a3d7 100644 --- a/test/parallel/test-global.js +++ b/test/parallel/test-global.js @@ -43,6 +43,7 @@ builtinModules.forEach((moduleName) => { { const expected = [ 'global', + 'queueMicrotask', 'clearImmediate', 'clearInterval', 'clearTimeout',