Node-Red configuration
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.

web.queue-microtask.js 1.1KB

12345678910111213141516171819202122232425
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var globalThis = require('../internals/global-this');
  4. var microtask = require('../internals/microtask');
  5. var aCallable = require('../internals/a-callable');
  6. var validateArgumentsLength = require('../internals/validate-arguments-length');
  7. var fails = require('../internals/fails');
  8. var DESCRIPTORS = require('../internals/descriptors');
  9. // Bun ~ 1.0.30 bug
  10. // https://github.com/oven-sh/bun/issues/9249
  11. var WRONG_ARITY = fails(function () {
  12. // getOwnPropertyDescriptor for prevent experimental warning in Node 11
  13. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  14. return DESCRIPTORS && Object.getOwnPropertyDescriptor(globalThis, 'queueMicrotask').value.length !== 1;
  15. });
  16. // `queueMicrotask` method
  17. // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask
  18. $({ global: true, enumerable: true, dontCallGetSet: true, forced: WRONG_ARITY }, {
  19. queueMicrotask: function queueMicrotask(fn) {
  20. validateArgumentsLength(arguments.length, 1);
  21. microtask(aCallable(fn));
  22. }
  23. });