(context: unknown, event: Event, isCapture: boolean)
| 247 | }; |
| 248 | |
| 249 | function globalCallback(context: unknown, event: Event, isCapture: boolean) { |
| 250 | // https://github.com/angular/zone.js/issues/911, in IE, sometimes |
| 251 | // event will be undefined, so we need to use window.event |
| 252 | event = event || _global.event; |
| 253 | if (!event) { |
| 254 | return; |
| 255 | } |
| 256 | // event.target is needed for Samsung TV and SourceBuffer |
| 257 | // || global is needed https://github.com/angular/zone.js/issues/190 |
| 258 | const target: any = context || event.target || _global; |
| 259 | const tasks = target[zoneSymbolEventNames[event.type][isCapture ? TRUE_STR : FALSE_STR]]; |
| 260 | if (tasks) { |
| 261 | const errors = []; |
| 262 | // invoke all tasks which attached to current target with given event.type and capture = false |
| 263 | // for performance concern, if task.length === 1, just invoke |
| 264 | if (tasks.length === 1) { |
| 265 | const err = invokeTask(tasks[0], target, event); |
| 266 | err && errors.push(err); |
| 267 | } else { |
| 268 | // https://github.com/angular/zone.js/issues/836 |
| 269 | // copy the tasks array before invoke, to avoid |
| 270 | // the callback will remove itself or other listener |
| 271 | const copyTasks = tasks.slice(); |
| 272 | for (let i = 0; i < copyTasks.length; i++) { |
| 273 | if (event && (event as any)[IMMEDIATE_PROPAGATION_SYMBOL] === true) { |
| 274 | break; |
| 275 | } |
| 276 | const err = invokeTask(copyTasks[i], target, event); |
| 277 | err && errors.push(err); |
| 278 | } |
| 279 | } |
| 280 | // Since there is only one error, we don't need to schedule microTask |
| 281 | // to throw the error. |
| 282 | if (errors.length === 1) { |
| 283 | throw errors[0]; |
| 284 | } else { |
| 285 | for (let i = 0; i < errors.length; i++) { |
| 286 | const err = errors[i]; |
| 287 | api.nativeScheduleMicroTask(() => { |
| 288 | throw err; |
| 289 | }); |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | // global shared zoneAwareCallback to handle all event callback with capture = false |
| 296 | const globalZoneAwareCallback = function (this: unknown, event: Event) { |
no test coverage detected
searching dependent graphs…