Sha256: f31b4fb68f347121408b9ab26e92ca6999ea5b3071d87671e727e3518465b4f0

Contents?: true

Size: 1021 Bytes

Versions: 48

Compression:

Stored size: 1021 Bytes

Contents

'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.hasNextTick = exports.hasSetImmediate = undefined;
exports.fallback = fallback;
exports.wrap = wrap;

var _slice = require('./slice');

var _slice2 = _interopRequireDefault(_slice);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var hasSetImmediate = exports.hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
var hasNextTick = exports.hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';

function fallback(fn) {
    setTimeout(fn, 0);
}

function wrap(defer) {
    return function (fn /*, ...args*/) {
        var args = (0, _slice2.default)(arguments, 1);
        defer(function () {
            fn.apply(null, args);
        });
    };
}

var _defer;

if (hasSetImmediate) {
    _defer = setImmediate;
} else if (hasNextTick) {
    _defer = process.nextTick;
} else {
    _defer = fallback;
}

exports.default = wrap(_defer);

Version data entries

48 entries across 46 versions & 11 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/async/internal/setImmediate.js
disco_app-0.18.0 test/dummy/node_modules/async/internal/setImmediate.js
disco_app-0.18.2 test/dummy/node_modules/async/internal/setImmediate.js
disco_app-0.16.1 test/dummy/node_modules/async/internal/setImmediate.js
disco_app-0.15.2 test/dummy/node_modules/async/internal/setImmediate.js
disco_app-0.18.4 test/dummy/node_modules/async/internal/setImmediate.js
disco_app-0.18.1 test/dummy/node_modules/async/internal/setImmediate.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/async/internal/setImmediate.js
disco_app-0.14.0 test/dummy/node_modules/async/internal/setImmediate.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/async/internal/setImmediate.js
tang-0.2.1 spec/tang_app/node_modules/async/internal/setImmediate.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/async/internal/setImmediate.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/async/internal/setImmediate.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/async/internal/setImmediate.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/async/internal/setImmediate.js
tang-0.2.0 spec/tang_app/node_modules/async/internal/setImmediate.js
tang-0.1.0 spec/tang_app/node_modules/async/internal/setImmediate.js
tang-0.0.9 spec/tang_app/node_modules/async/internal/setImmediate.js
enju_library-0.3.8 spec/dummy/node_modules/async/internal/setImmediate.js
ilog-0.4.1 node_modules/async/internal/setImmediate.js