@@ -75,6 +75,7 @@ export function patchEventTarget(
7575 return ;
7676 }
7777 const delegate = task . callback ;
78+ // p is 'object' string
7879 if ( typeof delegate === p && delegate . handleEvent ) {
7980 // create the bind version of handleEvent when invoke
8081 task . callback = ( event : Event ) => delegate . handleEvent ( event ) ;
@@ -83,6 +84,7 @@ export function patchEventTarget(
8384 // invoke static task.invoke
8485 task . invoke ( task , target , [ event ] ) ;
8586 const options = task . options ;
87+ // p is 'object' string
8688 if ( options && typeof options === p && options . once ) {
8789 // if options.once is true, after invoke once remove listener here
8890 // only browser need to do this, nodejs eventEmitter will cal removeListener
@@ -103,6 +105,7 @@ export function patchEventTarget(
103105 // event.target is needed for Samusung TV and SourceBuffer
104106 // || global is needed https://github.com/angular/zone.js/issues/190
105107 const target : any = this || event . target || _global ;
108+ // l is 'false' string
106109 const tasks = target [ ens [ event . type ] [ l ] ] ;
107110 if ( tasks ) {
108111 // invoke all tasks which attached to current target with given event.type and capture = false
@@ -135,6 +138,7 @@ export function patchEventTarget(
135138 // event.target is needed for Samusung TV and SourceBuffer
136139 // || global is needed https://github.com/angular/zone.js/issues/190
137140 const target : any = this || event . target || _global ;
141+ // k is 'true' string
138142 const tasks = target [ ens [ event . type ] [ k ] ] ;
139143 if ( tasks ) {
140144 // invoke all tasks which attached to current target with given event.type and capture = false
@@ -179,6 +183,7 @@ export function patchEventTarget(
179183
180184 let proto = obj ;
181185 while ( proto && ! proto . hasOwnProperty ( ADD_EVENT_LISTENER ) ) {
186+ // d is Object.getPrototypeOf
182187 proto = d ( proto ) ;
183188 }
184189 if ( ! proto && obj [ ADD_EVENT_LISTENER ] ) {
@@ -230,9 +235,11 @@ export function patchEventTarget(
230235 // from Zone.prototype.cancelTask, we should remove the task
231236 // from tasksList of target first
232237 if ( ! task . isRemoved ) {
238+ // ens is event names cache
233239 const symbolEventNames = ens [ task . eventName ] ;
234240 let symbolEventName ;
235241 if ( symbolEventNames ) {
242+ // k is 'true' string, l is 'false' string
236243 symbolEventName = symbolEventNames [ task . capture ? k : l ] ;
237244 }
238245 const existingTasks = symbolEventName && task . target [ symbolEventName ] ;
@@ -286,6 +293,7 @@ export function patchEventTarget(
286293
287294 const compareTaskCallbackVsDelegate = function ( task : any , delegate : any ) {
288295 const typeOfDelegate = typeof delegate ;
296+ // n is 'function' string, p is 'object' string
289297 if ( ( typeOfDelegate === n && task . callback === delegate ) ||
290298 ( typeOfDelegate === p && task . originalDelegate === delegate ) ) {
291299 // same callback, same capture, same event name, just return
@@ -313,6 +321,7 @@ export function patchEventTarget(
313321 // case here to improve addEventListener performance
314322 // we will create the bind delegate when invoke
315323 let isHandleEvent = false ;
324+ // n is 'function' string
316325 if ( typeof delegate !== n ) {
317326 if ( ! delegate . handleEvent ) {
318327 return nativeListener . apply ( this , arguments ) ;
@@ -349,16 +358,20 @@ export function patchEventTarget(
349358 once = options ? ! ! options . once : false ;
350359 }
351360
361+ // Zone.current
352362 const zone = ( Zone as any ) . c ;
353363 const symbolEventNames = ens [ eventName ] ;
354364 let symbolEventName ;
355365 if ( ! symbolEventNames ) {
356366 // the code is duplicate, but I just want to get some better performance
367+ // l is 'false' string, k is 'true' string
357368 const falseEventName = eventName + l ;
358369 const trueEventName = eventName + k ;
370+ // m is '__zone_symbol__' string
359371 const symbol = m + falseEventName ;
360372 const symbolCapture = m + trueEventName ;
361373 ens [ eventName ] = { } ;
374+ // l is 'false' string, k is 'true' string
362375 ens [ eventName ] [ l ] = symbol ;
363376 ens [ eventName ] [ k ] = symbolCapture ;
364377 symbolEventName = capture ? symbolCapture : symbol ;
@@ -411,6 +424,7 @@ export function patchEventTarget(
411424 ( data as any ) . taskData = taskData ;
412425 }
413426
427+ // Zone.scehduleEventTask
414428 const task : any =
415429 ( zone as any ) . se ( source , delegate , data , customScheduleFn , customCancelFn ) ;
416430
@@ -553,6 +567,7 @@ export function patchEventTarget(
553567 } else {
554568 const symbolEventNames = ens [ eventName ] ;
555569 if ( symbolEventNames ) {
570+ // l is 'false' string, k is 'true' string
556571 const symbolEventName = symbolEventNames [ l ] ;
557572 const symbolCaptureEventName = symbolEventNames [ k ] ;
558573
0 commit comments