You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.1 KiB
26 lines
1.1 KiB
2 weeks ago
|
'use strict';
|
||
|
var $ = require('../internals/export');
|
||
|
var globalThis = require('../internals/global-this');
|
||
|
var microtask = require('../internals/microtask');
|
||
|
var aCallable = require('../internals/a-callable');
|
||
|
var validateArgumentsLength = require('../internals/validate-arguments-length');
|
||
|
var fails = require('../internals/fails');
|
||
|
var DESCRIPTORS = require('../internals/descriptors');
|
||
|
|
||
|
// Bun ~ 1.0.30 bug
|
||
|
// https://github.com/oven-sh/bun/issues/9249
|
||
|
var WRONG_ARITY = fails(function () {
|
||
|
// getOwnPropertyDescriptor for prevent experimental warning in Node 11
|
||
|
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||
|
return DESCRIPTORS && Object.getOwnPropertyDescriptor(globalThis, 'queueMicrotask').value.length !== 1;
|
||
|
});
|
||
|
|
||
|
// `queueMicrotask` method
|
||
|
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask
|
||
|
$({ global: true, enumerable: true, dontCallGetSet: true, forced: WRONG_ARITY }, {
|
||
|
queueMicrotask: function queueMicrotask(fn) {
|
||
|
validateArgumentsLength(arguments.length, 1);
|
||
|
microtask(aCallable(fn));
|
||
|
}
|
||
|
});
|