Skip to content
Permalink
Browse files

lib: move queueMicrotask to stable

PR-URL: #25594
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
  • Loading branch information...
devsnek committed Jan 20, 2019
1 parent b05fd4b commit 9f1282d536dc8f0a11714980b4b78ee0b979e1de
Showing with 8 additions and 26 deletions.
  1. +0 −2 doc/api/globals.md
  2. +5 −23 lib/internal/bootstrap/node.js
  3. +2 −1 test/common/index.js
  4. +1 −0 test/parallel/test-global.js
@@ -114,8 +114,6 @@ added: v11.0.0

<!-- type=global -->

> Stability: 1 - Experimental
* `callback` {Function} Function to be queued.

The `queueMicrotask()` method queues a microtask to invoke `callback`. If
@@ -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,
});
}
@@ -258,7 +258,8 @@ let knownGlobals = [
global,
setImmediate,
setInterval,
setTimeout
setTimeout,
queueMicrotask,
];

if (global.gc) {
@@ -43,6 +43,7 @@ builtinModules.forEach((moduleName) => {
{
const expected = [
'global',
'queueMicrotask',
'clearImmediate',
'clearInterval',
'clearTimeout',

0 comments on commit 9f1282d

Please sign in to comment.
You can’t perform that action at this time.