| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							| 
									
										
										
										
											2020-05-19 12:08:49 -07:00
										 |  |  |  * Copyright Google LLC All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |  * Interface of `zone.js` configurations. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |  * You can define the following configurations on the `window/global` object before | 
					
						
							|  |  |  |  * importing `zone.js` to change `zone.js` default behaviors. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |  */ | 
					
						
							|  |  |  | interface ZoneGlobalConfigurations { | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the `Node.js` `EventEmitter` API. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches the `Node.js` `EventEmitter` APIs to make asynchronous | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * callbacks of those APIs in the same zone when scheduled. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const EventEmitter = require('events'); | 
					
						
							|  |  |  |    * class MyEmitter extends EventEmitter {} | 
					
						
							|  |  |  |    * const myEmitter = new MyEmitter(); | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   myEmitter.on('event', () => { | 
					
						
							|  |  |  |    *     console.log('an event occurs in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // the callback runs in the zone when it is scheduled,
 | 
					
						
							|  |  |  |    *     // so the output is 'an event occurs in the zone myZone'.
 | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * myEmitter.emit('event'); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_EventEmitter = true` before importing `zone.js`, | 
					
						
							|  |  |  |    * `zone.js` does not monkey patch the `EventEmitter` APIs and the above code | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * outputs 'an event occurred <root>'. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_EventEmitter?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the `Node.js` `fs` API. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches `Node.js` `fs` APIs to make asynchronous callbacks of | 
					
						
							|  |  |  |    * those APIs in the same zone when scheduled. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const fs = require('fs'); | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   fs.stat('/tmp/world', (err, stats) => { | 
					
						
							|  |  |  |    *     console.log('fs.stats() callback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // since the callback of the `fs.stat()` runs in the same zone
 | 
					
						
							|  |  |  |    *     // when it is called, so the output is 'fs.stats() callback is invoked in the zone myZone'.
 | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_fs = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch the `fs` API and the above code | 
					
						
							|  |  |  |    * outputs 'get stats occurred <root>'. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_fs?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the `Node.js` `timer` API. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches the `Node.js` `timer` APIs to make asynchronous | 
					
						
							|  |  |  |    * callbacks of those APIs in the same zone when scheduled. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   setTimeout(() => { | 
					
						
							|  |  |  |    *     console.log('setTimeout() callback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // since the callback of `setTimeout()` runs in the same zone
 | 
					
						
							|  |  |  |    *     // when it is scheduled, so the output is 'setTimeout() callback is invoked in the zone
 | 
					
						
							|  |  |  |    *     // myZone'.
 | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_timers = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch the `timer` APIs and the above code | 
					
						
							|  |  |  |    * outputs 'timeout <root>'. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_node_timers?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the `Node.js` `process.nextTick()` API. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * By default, `zone.js` monkey patches the `Node.js` `process.nextTick()` API to make the | 
					
						
							|  |  |  |    * callback in the same zone when calling `process.nextTick()`. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   process.nextTick(() => { | 
					
						
							|  |  |  |    *     console.log('process.nextTick() callback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // since the callback of `process.nextTick()` runs in the same zone
 | 
					
						
							|  |  |  |    *     // when it is scheduled, so the output is 'process.nextTick() callback is invoked in the
 | 
					
						
							|  |  |  |    *     // zone myZone'.
 | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_nextTick = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch the `process.nextTick()` API and the above code | 
					
						
							|  |  |  |    * outputs 'nextTick <root>'. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_nextTick?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the `Node.js` `crypto` API. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches the `Node.js` `crypto` APIs to make asynchronous callbacks | 
					
						
							|  |  |  |    * of those APIs in the same zone when called. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const crypto = require('crypto'); | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   crypto.randomBytes(() => { | 
					
						
							|  |  |  |    *     console.log('crypto.randomBytes() callback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // since the callback of `crypto.randomBytes()` runs in the same zone
 | 
					
						
							|  |  |  |    *     // when it is called, so the output is 'crypto.randomBytes() callback is invoked in the
 | 
					
						
							|  |  |  |    *     // zone myZone'.
 | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_crypto = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch the `crypto` API and the above code | 
					
						
							|  |  |  |    * outputs 'crypto <root>'. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_crypto?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the `Object.defineProperty()` API. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * Note: This configuration is available only in the legacy bundle (dist/zone.js). This module is | 
					
						
							|  |  |  |    * not available in the evergreen bundle (zone-evergreen.js). | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * In the legacy browser, the default behavior of `zone.js` is to monkey patch | 
					
						
							|  |  |  |    * `Object.defineProperty()` and `Object.create()` to try to ensure PropertyDescriptor parameter's | 
					
						
							|  |  |  |    * configurable property to be true. This patch is only needed in some old mobile browsers. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_defineProperty = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch the `Object.defineProperty()` API and does not | 
					
						
							|  |  |  |    * modify desc.configurable to true. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_defineProperty?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser `registerElement()` API. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * NOTE: This configuration is only available in the legacy bundle (dist/zone.js), this | 
					
						
							|  |  |  |    * module is not available in the evergreen bundle (zone-evergreen.js). | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * In the legacy browser, the default behavior of `zone.js` is to monkey patch the | 
					
						
							|  |  |  |    * `registerElement()` API to make asynchronous callbacks of the API in the same zone when | 
					
						
							|  |  |  |    * `registerElement()` is called. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const proto = Object.create(HTMLElement.prototype); | 
					
						
							|  |  |  |    * proto.createdCallback = function() { | 
					
						
							|  |  |  |    *   console.log('createdCallback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    * }; | 
					
						
							|  |  |  |    * proto.attachedCallback = function() { | 
					
						
							|  |  |  |    *   console.log('attachedCallback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    * }; | 
					
						
							|  |  |  |    * proto.detachedCallback = function() { | 
					
						
							|  |  |  |    *   console.log('detachedCallback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    * }; | 
					
						
							|  |  |  |    * proto.attributeChangedCallback = function() { | 
					
						
							|  |  |  |    *   console.log('attributeChangedCallback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    * }; | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   document.registerElement('x-elem', {prototype: proto}); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * When these callbacks are invoked, those callbacks will be in the zone when | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `registerElement()` is called. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_registerElement = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch `registerElement()` API and the above code | 
					
						
							|  |  |  |    * outputs '<root>'. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_registerElement?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser legacy `EventTarget` API. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * NOTE: This configuration is only available in the legacy bundle (dist/zone.js), this module | 
					
						
							|  |  |  |    * is not available in the evergreen bundle (zone-evergreen.js). | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * In some old browsers, the `EventTarget` is not available, so `zone.js` cannot directly monkey | 
					
						
							|  |  |  |    * patch the `EventTarget`. Instead, `zone.js` patches all known HTML elements' prototypes (such | 
					
						
							|  |  |  |    * as `HtmlDivElement`). The callback of the `addEventListener()` will be in the same zone when | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * the `addEventListener()` is called. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   div.addEventListener('click', () => { | 
					
						
							|  |  |  |    *     console.log('div click event listener is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // the output is 'div click event listener is invoked in the zone myZone'.
 | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_EventTargetLegacy = true` before importing `zone.js` | 
					
						
							|  |  |  |    * In some old browsers, where `EventTarget` is not available, if you set | 
					
						
							|  |  |  |    * `__Zone_disable_EventTargetLegacy = true` before importing `zone.js`, `zone.js` does not monkey | 
					
						
							|  |  |  |    * patch all HTML element APIs and the above code outputs 'clicked <root>'. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_EventTargetLegacy?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser `timer` APIs. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * By default, `zone.js` monkey patches browser timer | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * APIs (`setTimeout()`/`setInterval()`/`setImmediate()`) to make asynchronous callbacks of those | 
					
						
							|  |  |  |    * APIs in the same zone when scheduled. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   setTimeout(() => { | 
					
						
							|  |  |  |    *     console.log('setTimeout() callback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // since the callback of `setTimeout()` runs in the same zone
 | 
					
						
							|  |  |  |    *     // when it is scheduled, so the output is 'setTimeout() callback is invoked in the zone
 | 
					
						
							|  |  |  |    *     // myZone'.
 | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_timers = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch `timer` API and the above code | 
					
						
							|  |  |  |    * outputs 'timeout <root>'. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_timers?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser `requestAnimationFrame()` API. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches the browser `requestAnimationFrame()` API | 
					
						
							|  |  |  |    * to make the asynchronous callback of the `requestAnimationFrame()` in the same zone when | 
					
						
							|  |  |  |    * scheduled. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   requestAnimationFrame(() => { | 
					
						
							|  |  |  |    *     console.log('requestAnimationFrame() callback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // since the callback of `requestAnimationFrame()` will be in the same zone
 | 
					
						
							|  |  |  |    *     // when it is scheduled, so the output will be 'requestAnimationFrame() callback is invoked
 | 
					
						
							|  |  |  |    *     // in the zone myZone'
 | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_requestAnimationFrame = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch the `requestAnimationFrame()` API and the above code | 
					
						
							|  |  |  |    * outputs 'raf <root>'. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_requestAnimationFrame?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-19 14:10:32 +09:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Disable the monkey patching of the browser's `queueMicrotask()` API. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * By default, `zone.js` monkey patches the browser's `queueMicrotask()` API | 
					
						
							|  |  |  |    * to ensure that `queueMicrotask()` callback is invoked in the same zone as zone used to invoke | 
					
						
							|  |  |  |    * `queueMicrotask()`. And also the callback is running as `microTask` like | 
					
						
							|  |  |  |    * `Promise.prototype.then()`. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   queueMicrotask(() => { | 
					
						
							|  |  |  |    *     console.log('queueMicrotask() callback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // Since `queueMicrotask()` was invoked in `myZone`, same zone is restored
 | 
					
						
							|  |  |  |    *     // when 'queueMicrotask() callback is invoked, resulting in `myZone` being console logged.
 | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * If you set `__Zone_disable_queueMicrotask = true` before importing `zone.js`, | 
					
						
							|  |  |  |    * `zone.js` does not monkey patch the `queueMicrotask()` API and the above code | 
					
						
							|  |  |  |    * output will change to: 'queueMicrotask() callback is invoked in the zone <root>'. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_queueMicrotask?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser blocking APIs(`alert()`/`prompt()`/`confirm()`). | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_blocking?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser `EventTarget` APIs. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches EventTarget APIs. The callbacks of the | 
					
						
							|  |  |  |    * `addEventListener()` run in the same zone when the `addEventListener()` is called. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   div.addEventListener('click', () => { | 
					
						
							|  |  |  |    *     console.log('div event listener is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // the output is 'div event listener is invoked in the zone myZone'.
 | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_EventTarget = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch EventTarget API and the above code | 
					
						
							|  |  |  |    * outputs 'clicked <root>'. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_EventTarget?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-19 23:14:28 +09:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser `FileReader` APIs. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_FileReader?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser `MutationObserver` APIs. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_MutationObserver?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser `IntersectionObserver` APIs. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_IntersectionObserver?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser onProperty APIs(such as onclick). | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches onXXX properties (such as onclick). The callbacks of onXXX | 
					
						
							|  |  |  |    * properties run in the same zone when the onXXX properties is set. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   div.onclick = () => { | 
					
						
							|  |  |  |    *     console.log('div click event listener is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // the output will be 'div click event listener is invoked in the zone myZone'
 | 
					
						
							|  |  |  |    *   } | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_on_property = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch onXXX properties and the above code | 
					
						
							|  |  |  |    * outputs 'clicked <root>'. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_on_property?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser `customElements` APIs. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches `customElements` APIs to make callbacks run in the | 
					
						
							|  |  |  |    * same zone when the `customElements.define()` is called. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * class TestCustomElement extends HTMLElement { | 
					
						
							|  |  |  |    *   constructor() { super(); } | 
					
						
							|  |  |  |    *   connectedCallback() {} | 
					
						
							|  |  |  |    *   disconnectedCallback() {} | 
					
						
							|  |  |  |    *   attributeChangedCallback(attrName, oldVal, newVal) {} | 
					
						
							|  |  |  |    *   adoptedCallback() {} | 
					
						
							|  |  |  |    * } | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * const zone = Zone.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   customElements.define('x-elem', TestCustomElement); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * All those callbacks defined in TestCustomElement runs in the zone when | 
					
						
							|  |  |  |    * the `customElements.define()` is called. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_customElements = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch `customElements` APIs and the above code | 
					
						
							|  |  |  |    * runs inside <root> zone. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_customElements?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser `XMLHttpRequest` APIs. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches `XMLHttpRequest` APIs to make XMLHttpRequest act | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * as macroTask. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({ | 
					
						
							|  |  |  |    *   name: 'myZone', | 
					
						
							|  |  |  |    *   onScheduleTask: (delegate, curr, target, task) => { | 
					
						
							|  |  |  |    *     console.log('task is scheduled', task.type, task.source, task.zone.name); | 
					
						
							|  |  |  |    *     return delegate.scheduleTask(target, task); | 
					
						
							|  |  |  |    *   } | 
					
						
							|  |  |  |    * }) | 
					
						
							|  |  |  |    * const xhr = new XMLHttpRequest(); | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   xhr.onload = function() {}; | 
					
						
							|  |  |  |    *   xhr.open('get', '/', true); | 
					
						
							|  |  |  |    *   xhr.send(); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * In this example, the instance of XMLHttpRequest runs in the zone and acts as a macroTask. The | 
					
						
							|  |  |  |    * output is 'task is scheduled macroTask, XMLHttpRequest.send, zone'. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_XHR = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch `XMLHttpRequest` APIs and the above onScheduleTask callback | 
					
						
							|  |  |  |    * will not be called. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_XHR?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser geolocation APIs. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches geolocation APIs to make callbacks run in the same zone | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * when those APIs are called. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Consider the following examples: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({ | 
					
						
							|  |  |  |    *   name: 'myZone' | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   navigator.geolocation.getCurrentPosition(pos => { | 
					
						
							|  |  |  |    *     console.log('navigator.getCurrentPosition() callback is invoked in the zone', | 
					
						
							|  |  |  |    *     Zone.current.name); | 
					
						
							|  |  |  |    *     // output is 'navigator.getCurrentPosition() callback is invoked in the zone myZone'.
 | 
					
						
							|  |  |  |    *   } | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If set you `__Zone_disable_geolocation = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch geolocation APIs and the above code | 
					
						
							|  |  |  |    * outputs 'getCurrentPosition <root>'. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_geolocation?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the monkey patch of the browser `canvas` APIs. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches `canvas` APIs to make callbacks run in the same zone when | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * those APIs are called. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({ | 
					
						
							|  |  |  |    *   name: 'myZone' | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   canvas.toBlob(blog => { | 
					
						
							|  |  |  |    *     console.log('canvas.toBlob() callback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // output is 'canvas.toBlob() callback is invoked in the zone myZone'.
 | 
					
						
							|  |  |  |    *   } | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_canvas = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch `canvas` APIs and the above code | 
					
						
							|  |  |  |    * outputs 'canvas.toBlob <root>'. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_canvas?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable the `Promise` monkey patch. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches `Promise` APIs to make the `then()/catch()` callbacks in | 
					
						
							|  |  |  |    * the same zone when those callbacks are called. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following examples: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * const zone = Zone.current.fork({name: 'myZone'}); | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * const p = Promise.resolve(1); | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * zone.run(() => { | 
					
						
							|  |  |  |    *   p.then(() => { | 
					
						
							|  |  |  |    *     console.log('then() callback is invoked in the zone', Zone.current.name); | 
					
						
							|  |  |  |    *     // output is 'then() callback is invoked in the zone myZone'.
 | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_ZoneAwarePromise = true` before importing `zone.js`, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * `zone.js` does not monkey patch `Promise` APIs and the above code | 
					
						
							|  |  |  |    * outputs 'promise then callback <root>'. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_ZoneAwarePromise?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Define event names that users don't want monkey patched by the `zone.js`. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone.js` monkey patches EventTarget.addEventListener(). The event listener | 
					
						
							|  |  |  |    * callback runs in the same zone when the addEventListener() is called. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * Sometimes, you don't want all of the event names used in this patched version because it | 
					
						
							|  |  |  |    * impacts performance. For example, you might want `scroll` or `mousemove` event listeners to run | 
					
						
							|  |  |  |    * the native `addEventListener()` for better performance. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Users can achieve this goal by defining `__zone_symbol__UNPATCHED_EVENTS = ['scroll',
 | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * 'mousemove'];` before importing `zone.js`.
 | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2020-03-26 21:46:46 +09:00
										 |  |  |   __zone_symbol__UNPATCHED_EVENTS?: string[]; | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Define the event names of the passive listeners. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * To add passive event listeners, you can use `elem.addEventListener('scroll', listener,
 | 
					
						
							|  |  |  |    * {passive: true});` or implement your own `EventManagerPlugin`.
 | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * You can also define a global variable as follows: | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * __zone_symbol__PASSIVE_EVENTS = ['scroll']; | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * The preceding code makes all scroll event listeners passive. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2020-03-26 21:46:46 +09:00
										 |  |  |   __zone_symbol__PASSIVE_EVENTS?: string[]; | 
					
						
							| 
									
										
										
										
											2020-03-09 20:01:50 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable wrapping uncaught promise rejection. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * By default, `zone.js` wraps the uncaught promise rejection in a new `Error` object | 
					
						
							|  |  |  |    * which contains additional information such as a value of the rejection and a stack trace. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * If you set `__zone_symbol__DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION = true;` before | 
					
						
							|  |  |  |    * importing `zone.js`, `zone.js` will not wrap the uncaught promise rejection. | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __zone_symbol__DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION?: boolean; | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |  * Interface of `zone-testing.js` test configurations. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |  * You can define the following configurations on the `window` or `global` object before | 
					
						
							|  |  |  |  * importing `zone-testing.js` to change `zone-testing.js` default behaviors in the test runner. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |  */ | 
					
						
							|  |  |  | interface ZoneTestConfigurations { | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * Disable the Jasmine integration. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * In the `zone-testing.js` bundle, by default, `zone-testing.js` monkey patches Jasmine APIs | 
					
						
							|  |  |  |    * to make Jasmine APIs run in specified zone. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * 1. Make the `describe()`/`xdescribe()`/`fdescribe()` methods run in the syncTestZone. | 
					
						
							|  |  |  |    * 2. Make the `it()`/`xit()`/`fit()`/`beforeEach()`/`afterEach()`/`beforeAll()`/`afterAll()` | 
					
						
							|  |  |  |    * methods run in the ProxyZone. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * With this patch, `async()`/`fakeAsync()` can work with the Jasmine runner. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_jasmine = true` before importing `zone-testing.js`, | 
					
						
							|  |  |  |    * `zone-testing.js` does not monkey patch the jasmine APIs and the `async()`/`fakeAsync()` cannot | 
					
						
							|  |  |  |    * work with the Jasmine runner any longer. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_jasmine?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * Disable the Mocha integration. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * In the `zone-testing.js` bundle, by default, `zone-testing.js` monkey patches the Mocha APIs | 
					
						
							|  |  |  |    * to make Mocha APIs run in the specified zone. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * 1. Make the `describe()`/`xdescribe()`/`fdescribe()` methods run in the syncTestZone. | 
					
						
							|  |  |  |    * 2. Make the `it()`/`xit()`/`fit()`/`beforeEach()`/`afterEach()`/`beforeAll()`/`afterAll()` | 
					
						
							|  |  |  |    * methods run in the ProxyZone. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * With this patch, `async()`/`fakeAsync()` can work with the Mocha runner. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_mocha = true` before importing `zone-testing.js`, | 
					
						
							|  |  |  |    * `zone-testing.js` does not monkey patch the Mocha APIs and the `async()/`fakeAsync()` can not
 | 
					
						
							|  |  |  |    * work with the Mocha runner any longer. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_mocha?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * Disable the Jest integration. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * In the `zone-testing.js` bundle, by default, `zone-testing.js` monkey patches Jest APIs | 
					
						
							|  |  |  |    * to make Jest APIs run in the specified zone. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * 1. Make the `describe()`/`xdescribe()`/`fdescribe()` methods run in the syncTestZone. | 
					
						
							|  |  |  |    * 2. Make the `it()`/`xit()`/`fit()`/`beforeEach()`/`afterEach()`/`before()`/`after()` methods | 
					
						
							|  |  |  |    * run in the ProxyZone. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * With this patch, `async()`/`fakeAsync()` can work with the Jest runner. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * If you set `__Zone_disable_jest = true` before importing `zone-testing.js`, | 
					
						
							|  |  |  |    * `zone-testing.js` does not monkey patch the jest APIs and `async()`/`fakeAsync()` cannot | 
					
						
							|  |  |  |    * work with the Jest runner any longer. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    */ | 
					
						
							|  |  |  |   __Zone_disable_jest?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Disable monkey patch the jasmine clock APIs. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone-testing.js` monkey patches the `jasmine.clock()` API, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * so the `jasmine.clock()` can work with the `fakeAsync()/tick()` API. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * describe('jasmine.clock integration', () => { | 
					
						
							|  |  |  |    *   beforeEach(() => { | 
					
						
							|  |  |  |    *     jasmine.clock().install(); | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    *   afterEach(() => { | 
					
						
							|  |  |  |    *     jasmine.clock().uninstall(); | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    *   it('fakeAsync test', fakeAsync(() => { | 
					
						
							|  |  |  |    *     setTimeout(spy, 100); | 
					
						
							|  |  |  |    *     expect(spy).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |    *     jasmine.clock().tick(100); | 
					
						
							|  |  |  |    *     expect(spy).toHaveBeenCalled(); | 
					
						
							|  |  |  |    *   })); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * In the `fakeAsync()` method, `jasmine.clock().tick()` works just like `tick()`. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * If you set `__zone_symbol__fakeAsyncDisablePatchingClock = true` before importing | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * `zone-testing.js`,`zone-testing.js` does not monkey patch the `jasmine.clock()` APIs and the | 
					
						
							|  |  |  |    * `jasmine.clock()` cannot work with `fakeAsync()` any longer. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    */ | 
					
						
							|  |  |  |   __zone_symbol__fakeAsyncDisablePatchingClock?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Enable auto running into `fakeAsync()` when installing the `jasmine.clock()`. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, `zone-testing.js` does not automatically run into `fakeAsync()` | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * if the `jasmine.clock().install()` is called. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * describe('jasmine.clock integration', () => { | 
					
						
							|  |  |  |    *   beforeEach(() => { | 
					
						
							|  |  |  |    *     jasmine.clock().install(); | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    *   afterEach(() => { | 
					
						
							|  |  |  |    *     jasmine.clock().uninstall(); | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    *   it('fakeAsync test', fakeAsync(() => { | 
					
						
							|  |  |  |    *     setTimeout(spy, 100); | 
					
						
							|  |  |  |    *     expect(spy).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |    *     jasmine.clock().tick(100); | 
					
						
							|  |  |  |    *     expect(spy).toHaveBeenCalled(); | 
					
						
							|  |  |  |    *   })); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * You must run `fakeAsync()` to make test cases in the `FakeAsyncTestZone`. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * If you set `__zone_symbol__fakeAsyncAutoFakeAsyncWhenClockPatched = true` before importing | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * `zone-testing.js`, `zone-testing.js` can run test case automatically in the | 
					
						
							|  |  |  |    * `FakeAsyncTestZone` without calling the `fakeAsync()`. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * describe('jasmine.clock integration', () => { | 
					
						
							|  |  |  |    *   beforeEach(() => { | 
					
						
							|  |  |  |    *     jasmine.clock().install(); | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    *   afterEach(() => { | 
					
						
							|  |  |  |    *     jasmine.clock().uninstall(); | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    *   it('fakeAsync test', () => { // here we don't need to call fakeAsync
 | 
					
						
							|  |  |  |    *     setTimeout(spy, 100); | 
					
						
							|  |  |  |    *     expect(spy).not.toHaveBeenCalled(); | 
					
						
							|  |  |  |    *     jasmine.clock().tick(100); | 
					
						
							|  |  |  |    *     expect(spy).toHaveBeenCalled(); | 
					
						
							|  |  |  |    *   }); | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   __zone_symbol__fakeAsyncAutoFakeAsyncWhenClockPatched?: boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Enable waiting for the unresolved promise in the `async()` test. | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * In the `async()` test, `AsyncTestZone` waits for all the asynchronous tasks to finish. By | 
					
						
							|  |  |  |    * default, if some promises remain unresolved, `AsyncTestZone` does not wait and reports that it | 
					
						
							|  |  |  |    * received an unexpected result. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * Consider the following example: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * describe('wait never resolved promise', () => { | 
					
						
							|  |  |  |    *   it('async with never resolved promise test', async(() => { | 
					
						
							|  |  |  |    *     const p = new Promise(() => {}); | 
					
						
							|  |  |  |    *     p.then(() => { | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    *       // do some expectation.
 | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    *     }); | 
					
						
							|  |  |  |    *   })) | 
					
						
							|  |  |  |    * }); | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, this case passes, because the callback of `p.then()` is never called. Because `p` | 
					
						
							|  |  |  |    * is an unresolved promise, there is no pending asynchronous task, which means the `async()` | 
					
						
							|  |  |  |    * method does not wait. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							|  |  |  |    * If you set `__zone_symbol__supportWaitUnResolvedChainedPromise = true`, the above case | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * times out, because `async()` will wait for the unresolved promise. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    */ | 
					
						
							|  |  |  |   __zone_symbol__supportWaitUnResolvedChainedPromise?: boolean; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |  * The interface of the `zone.js` runtime configurations. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |  * These configurations can be defined on the `Zone` object after | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |  * importing zone.js to change behaviors. The differences between | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |  * the `ZoneRuntimeConfigurations` and the `ZoneGlobalConfigurations` are, | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |  * 1. `ZoneGlobalConfigurations` must be defined on the `global/window` object before importing | 
					
						
							|  |  |  |  * `zone.js`. The value of the configuration cannot be changed at runtime. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |  * 2. `ZoneRuntimeConfigurations` must be defined on the `Zone` object after importing `zone.js`. | 
					
						
							|  |  |  |  * You can change the value of this configuration at runtime. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | interface ZoneRuntimeConfigurations { | 
					
						
							|  |  |  |   /** | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * Ignore outputting errors to the console when uncaught Promise errors occur. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * By default, if an uncaught Promise error occurs, `zone.js` outputs the | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    * error to the console by calling `console.error()`. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * If you set `__zone_symbol__ignoreConsoleErrorUncaughtError = true`, `zone.js` does not output | 
					
						
							| 
									
										
										
										
											2020-03-04 10:46:02 +09:00
										 |  |  |    * the uncaught error to `console.error()`. | 
					
						
							| 
									
										
										
										
											2020-02-11 05:10:33 +09:00
										 |  |  |    */ | 
					
						
							|  |  |  |   __zone_symbol__ignoreConsoleErrorUncaughtError?: boolean; | 
					
						
							|  |  |  | } |