Skip to content

Commit 9f1282d

Browse files
committed
lib: move queueMicrotask to stable
PR-URL: #25594 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
1 parent b05fd4b commit 9f1282d

File tree

4 files changed

+8
-26
lines changed

4 files changed

+8
-26
lines changed

doc/api/globals.md

-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ added: v11.0.0
114114

115115
<!-- type=global -->
116116

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

121119
The `queueMicrotask()` method queues a microtask to invoke `callback`. If

lib/internal/bootstrap/node.js

+5-23
Original file line numberDiff line numberDiff line change
@@ -396,30 +396,12 @@ function createGlobalConsole(consoleFromVM) {
396396
}
397397

398398
function setupQueueMicrotask() {
399+
const { queueMicrotask } =
400+
NativeModule.require('internal/queue_microtask');
399401
Object.defineProperty(global, 'queueMicrotask', {
400-
get() {
401-
process.emitWarning('queueMicrotask() is experimental.',
402-
'ExperimentalWarning');
403-
const { queueMicrotask } =
404-
NativeModule.require('internal/queue_microtask');
405-
406-
Object.defineProperty(global, 'queueMicrotask', {
407-
value: queueMicrotask,
408-
writable: true,
409-
enumerable: false,
410-
configurable: true,
411-
});
412-
return queueMicrotask;
413-
},
414-
set(v) {
415-
Object.defineProperty(global, 'queueMicrotask', {
416-
value: v,
417-
writable: true,
418-
enumerable: false,
419-
configurable: true,
420-
});
421-
},
422-
enumerable: false,
402+
value: queueMicrotask,
403+
writable: true,
404+
enumerable: true,
423405
configurable: true,
424406
});
425407
}

test/common/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ let knownGlobals = [
258258
global,
259259
setImmediate,
260260
setInterval,
261-
setTimeout
261+
setTimeout,
262+
queueMicrotask,
262263
];
263264

264265
if (global.gc) {

test/parallel/test-global.js

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ builtinModules.forEach((moduleName) => {
4343
{
4444
const expected = [
4545
'global',
46+
'queueMicrotask',
4647
'clearImmediate',
4748
'clearInterval',
4849
'clearTimeout',

0 commit comments

Comments
 (0)