source: trip-planner-front/node_modules/async/internal/setImmediate.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1021 bytes
RevLine 
[6a3a178]1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.hasNextTick = exports.hasSetImmediate = undefined;
7exports.fallback = fallback;
8exports.wrap = wrap;
9
10var _slice = require('./slice');
11
12var _slice2 = _interopRequireDefault(_slice);
13
14function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
16var hasSetImmediate = exports.hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
17var hasNextTick = exports.hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';
18
19function fallback(fn) {
20 setTimeout(fn, 0);
21}
22
23function wrap(defer) {
24 return function (fn /*, ...args*/) {
25 var args = (0, _slice2.default)(arguments, 1);
26 defer(function () {
27 fn.apply(null, args);
28 });
29 };
30}
31
32var _defer;
33
34if (hasSetImmediate) {
35 _defer = setImmediate;
36} else if (hasNextTick) {
37 _defer = process.nextTick;
38} else {
39 _defer = fallback;
40}
41
42exports.default = wrap(_defer);
Note: See TracBrowser for help on using the repository browser.