es7.asap.js 442 B

123456789101112
  1. // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask
  2. var $export = require('./_export');
  3. var microtask = require('./_microtask')();
  4. var process = require('./_global').process;
  5. var isNode = require('./_cof')(process) == 'process';
  6. $export($export.G, {
  7. asap: function asap(fn) {
  8. var domain = isNode && process.domain;
  9. microtask(domain ? domain.bind(fn) : fn);
  10. }
  11. });