@@ -145,14 +145,15 @@ const zoneWrapFn = (it: (...args: any[]) => any, macrotask: MacroTask|undefined)
145
145
// function() is needed for the arguments object
146
146
// tslint:disable-next-line:only-arrow-functions
147
147
return function ( ) {
148
+ const _arguments = arguments ;
148
149
if ( macrotask ) {
149
150
setTimeout ( ( ) => {
150
151
if ( macrotask . state === 'scheduled' ) {
151
152
macrotask . invoke ( ) ;
152
153
}
153
154
} , 10 ) ;
154
155
}
155
- return run ( ( ) => it . apply ( _this , arguments ) ) ;
156
+ return run ( ( ) => it . apply ( _this , _arguments ) ) ;
156
157
} ;
157
158
} ;
158
159
@@ -161,18 +162,19 @@ export const ɵzoneWrap = <T= unknown>(it: T, blockUntilFirst: boolean): T => {
161
162
// tslint:disable-next-line:only-arrow-functions
162
163
return function ( ) {
163
164
let macrotask : MacroTask | undefined ;
165
+ const _arguments = arguments ;
164
166
// if this is a callback function, e.g, onSnapshot, we should create a microtask and invoke it
165
167
// only once one of the callback functions is tripped.
166
168
for ( let i = 0 ; i < arguments . length ; i ++ ) {
167
- if ( typeof arguments [ i ] === 'function' ) {
169
+ if ( typeof _arguments [ i ] === 'function' ) {
168
170
if ( blockUntilFirst ) {
169
171
macrotask ||= run ( ( ) => Zone . current . scheduleMacroTask ( 'firebaseZoneBlock' , noop , { } , noop , noop ) ) ;
170
172
}
171
173
// TODO create a microtask to track callback functions
172
- arguments [ i ] = zoneWrapFn ( arguments [ i ] , macrotask ) ;
174
+ _arguments [ i ] = zoneWrapFn ( _arguments [ i ] , macrotask ) ;
173
175
}
174
176
}
175
- const ret = runOutsideAngular ( ( ) => ( it as any ) . apply ( this , arguments ) ) ;
177
+ const ret = runOutsideAngular ( ( ) => ( it as any ) . apply ( this , _arguments ) ) ;
176
178
if ( ! blockUntilFirst ) {
177
179
if ( ret instanceof Observable ) {
178
180
const schedulers = getSchedulers ( ) ;
0 commit comments