mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Avoid using setImmediate in IE because it cannot be cleared with clearTimeout.
Former-commit-id: 836d49c6440b2313f1885456645ed4a00ab82ae6
This commit is contained in:
15
dist/lodash.underscore.js
vendored
15
dist/lodash.underscore.js
vendored
@@ -12,6 +12,9 @@
|
||||
/** Detect free variable `exports` */
|
||||
var freeExports = typeof exports == 'object' && exports;
|
||||
|
||||
/** Detect free variable `module` */
|
||||
var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
|
||||
|
||||
/** Detect free variable `global` and use it as `window` */
|
||||
var freeGlobal = typeof global == 'object' && global;
|
||||
if (freeGlobal.global === freeGlobal) {
|
||||
@@ -3463,10 +3466,14 @@
|
||||
* _.defer(function() { alert('deferred'); });
|
||||
* // returns from the function before `alert` is called
|
||||
*/
|
||||
var defer = reNative.test(window.setImmediate) && bind(setImmediate, window) || function(func) {
|
||||
function defer(func) {
|
||||
var args = slice(arguments, 1);
|
||||
return setTimeout(function() { func.apply(undefined, args); }, 1);
|
||||
};
|
||||
}
|
||||
// use Node's `setImmediate`, if available
|
||||
if (isV8 && freeModule && typeof setImmediate == 'function') {
|
||||
defer = bind(setImmediate, window);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a function that memoizes the result of `func`. If `resolver` is
|
||||
@@ -4285,8 +4292,8 @@
|
||||
|
||||
if (freeExports) {
|
||||
// in Node.js or RingoJS v0.8.0+
|
||||
if (typeof module == 'object' && module && module.exports == freeExports) {
|
||||
(module.exports = lodash)._ = lodash;
|
||||
if (freeModule) {
|
||||
(freeModule.exports = lodash)._ = lodash;
|
||||
}
|
||||
// in Narwhal or RingoJS v0.7.0-
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user