JAVASCRIPT   31

web queue microtask js

Guest on 26th June 2022 03:45:23 AM

  1. var $ = require('../internals/export');
  2. var global = require('../internals/global');
  3. var microtask = require('../internals/microtask');
  4. var classof = require('../internals/classof-raw');
  5.  
  6. var process = global.process;
  7. var isNode = classof(process) == 'process';
  8.  
  9. // `queueMicrotask` method
  10. //
  11. $({ global: true, enumerable: true, noTargetGet: true }, {
  12.   queueMicrotask: function queueMicrotask(fn) {
  13.     var domain = isNode && process.domain;
  14.     microtask(domain ? domain.bind(fn) : fn);
  15.   }
  16. });

Raw Paste


Login or Register to edit or fork this paste. It's free.