File tree Expand file tree Collapse file tree 1 file changed +13
-29
lines changed
Expand file tree Collapse file tree 1 file changed +13
-29
lines changed Original file line number Diff line number Diff line change 188188 //// nextTick implementation with browser-compatible fallback ////
189189
190190 // capture the global reference to guard against fakeTimer mocks
191- var _setImmediate ;
192- if ( typeof setImmediate === 'function' ) {
193- _setImmediate = setImmediate ;
194- }
191+ var _setImmediate = typeof setImmediate === 'function' && setImmediate ;
195192
196- if ( typeof process === 'undefined' || ! ( process . nextTick ) ) {
197- if ( _setImmediate ) {
198- async . nextTick = function ( fn ) {
199- // not a direct alias for IE10 compatibility
200- _setImmediate ( fn ) ;
201- } ;
202- async . setImmediate = async . nextTick ;
203- }
204- else {
205- async . nextTick = function ( fn ) {
206- setTimeout ( fn , 0 ) ;
207- } ;
208- async . setImmediate = async . nextTick ;
209- }
210- }
211- else {
193+ var _delay = _setImmediate ? function ( fn ) {
194+ // not a direct alias for IE10 compatibility
195+ _setImmediate ( fn ) ;
196+ } : function ( fn ) {
197+ setTimeout ( fn , 0 ) ;
198+ } ;
199+
200+ if ( typeof process === 'object' && typeof process . nextTick === 'function' ) {
212201 async . nextTick = process . nextTick ;
213- if ( _setImmediate ) {
214- async . setImmediate = function ( fn ) {
215- // not a direct alias for IE10 compatibility
216- _setImmediate ( fn ) ;
217- } ;
218- }
219- else {
220- async . setImmediate = async . nextTick ;
221- }
202+ } else {
203+ async . nextTick = _delay ;
222204 }
205+ async . setImmediate = _setImmediate ? _delay : async . nextTick ;
206+
223207
224208 async . forEach =
225209 async . each = function ( arr , iterator , callback ) {
You can’t perform that action at this time.
0 commit comments