source: trip-planner-front/node_modules/async/nextTick.js@ ceaed42

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

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _setImmediate = require('./internal/setImmediate');
8
9/**
10 * Calls `callback` on a later loop around the event loop. In Node.js this just
11 * calls `process.nextTick`. In the browser it will use `setImmediate` if
12 * available, otherwise `setTimeout(callback, 0)`, which means other higher
13 * priority events may precede the execution of `callback`.
14 *
15 * This is used internally for browser-compatibility purposes.
16 *
17 * @name nextTick
18 * @static
19 * @memberOf module:Utils
20 * @method
21 * @see [async.setImmediate]{@link module:Utils.setImmediate}
22 * @category Util
23 * @param {Function} callback - The function to call on a later loop around
24 * the event loop. Invoked with (args...).
25 * @param {...*} args... - any number of additional arguments to pass to the
26 * callback on the next tick.
27 * @example
28 *
29 * var call_order = [];
30 * async.nextTick(function() {
31 * call_order.push('two');
32 * // call_order now equals ['one','two']
33 * });
34 * call_order.push('one');
35 *
36 * async.setImmediate(function (a, b, c) {
37 * // a, b, and c equal 1, 2, and 3
38 * }, 1, 2, 3);
39 */
40var _defer;
41
42if (_setImmediate.hasNextTick) {
43 _defer = process.nextTick;
44} else if (_setImmediate.hasSetImmediate) {
45 _defer = setImmediate;
46} else {
47 _defer = _setImmediate.fallback;
48}
49
50exports.default = (0, _setImmediate.wrap)(_defer);
51module.exports = exports['default'];
Note: See TracBrowser for help on using the repository browser.