mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Make _.defer use setImmediate if available.
Former-commit-id: b3898d78725a4b203856916b1b071ab9c6f40b83
This commit is contained in:
8
dist/lodash.js
vendored
8
dist/lodash.js
vendored
@@ -292,7 +292,7 @@
|
||||
'\n } ';
|
||||
} else {
|
||||
__p += '\n for (index in iterable) {';
|
||||
if ( obj.useHas) {
|
||||
if (obj.useHas) {
|
||||
__p += '\n if (';
|
||||
if (obj.useHas) {
|
||||
__p += 'hasOwnProperty.call(iterable, index)';
|
||||
@@ -302,7 +302,7 @@
|
||||
__p +=
|
||||
(obj.loop ) +
|
||||
'; ';
|
||||
if ( obj.useHas) {
|
||||
if (obj.useHas) {
|
||||
__p += '\n }';
|
||||
} ;
|
||||
__p += '\n } ';
|
||||
@@ -4074,10 +4074,10 @@
|
||||
* _.defer(function() { alert('deferred'); });
|
||||
* // returns from the function before `alert` is called
|
||||
*/
|
||||
function defer(func) {
|
||||
var defer = reNative.test(window.setImmediate) && bind(setImmediate, window) || function(func) {
|
||||
var args = slice(arguments, 1);
|
||||
return setTimeout(function() { func.apply(undefined, args); }, 1);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a function that memoizes the result of `func`. If `resolver` is
|
||||
|
||||
Reference in New Issue
Block a user