web.queue-microtask.js 554 B

1234567891011121314
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var microtask = require('../internals/microtask');
  4. var aCallable = require('../internals/a-callable');
  5. var validateArgumentsLength = require('../internals/validate-arguments-length');
  6. // `queueMicrotask` method
  7. // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask
  8. $({ global: true, enumerable: true, dontCallGetSet: true }, {
  9. queueMicrotask: function queueMicrotask(fn) {
  10. validateArgumentsLength(arguments.length, 1);
  11. microtask(aCallable(fn));
  12. }
  13. });