@rx-angular/cdk
Version:
@rx-angular/cdk is a Component Development Kit for ergonomic and highly performant angular applications. It helps to to build Large scale applications, UI libs, state management, rendering systems and much more. Furthermore the unique way of mixing reacti
1,205 lines (1,202 loc) • 65.1 kB
TypeScript
declare const focusEvents: readonly ["blur", "focus", "focusin", "focusout"];
/**
* Mouse Events
* (MouseEvent)[https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent]
*/
declare const mouseEvents: readonly ["mousedown", "dblclick", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "click"];
/**
* Wheel Events
* (WheelEvent)[https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent]
*/
declare const wheelEvents: readonly ["wheel", "mousewheel"];
declare const inputEvents: readonly ["input", "invalid", "change", "reset", "select", "submit"];
/**
* @deprecated
*/
declare const formControlsEvents: readonly ["input", "invalid", "change", "reset", "select", "submit"];
declare const keyboardEvents: readonly ["keydown", "keypress", "keyup"];
declare const vrEvents: readonly ["vrdisplayactivate", "vrdisplayblur", "vrdisplayconnect", "vrdisplaydeactivate", "vrdisplaydisconnect", "vrdisplayfocus", "vrdisplaypointerrestricted", "vrdisplaypointerunrestricted", "vrdisplaypresentchange"];
declare const mSGestureEvents: readonly ["MSGestureChange", "MSGestureDoubleTap", "MSGestureEnd", "MSGestureHold", "MSGestureStart", "MSGestureTap", "MSInertiaStart", "MSPointerCancel", "MSPointerDown", "MSPointerEnter", "MSPointerLeave", "MSPointerMove", "MSPointerOut", "MSPointerOver", "MSPointerUp"];
declare const printEvents: readonly ["afterprint", "beforeprint"];
declare const networkEvents: readonly ["offline", "online"];
declare const audioEvents: readonly ["canplay", "canplaythrough", "pause", "play", "playing", "volumechange"];
declare const compositionEvents: readonly ["compositionstart", "compositionupdate", "compositionend"];
/**
* Touch Events
* [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent)
* [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent)
*/
declare const touchEvents: readonly ["pointerover", "pointerenter", "pointerdown", "pointermove", "pointerup", "pointercancel", "pointerout", "pointerleave", "gotpointercapture", "lostpointercapture", "pointerup", "touchstart", "touchend", "touchmove", "touchcancel", "drag", "dragend", "dragexit", "dragenter", "dragleave", "dragover", "dragstart", "drop"];
declare const globalEvents: readonly ["contextmenu", "resize", "scroll", "abort", "load", "loadeddata", "loadedmetadata", "loadstart", "unload", "error"];
declare const websocketEvents: readonly ["close", "error", "message", "open"];
/**
* Basic XHR Events
* [Load](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/load_event)
* [Error](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/error_event)
* There are more events you may want to unpatch https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
*/
declare const xhrEvents: readonly ["load", "error"];
declare const windowEvents: readonly ["compassneedscalibration", "durationchange", "emptied", "ended", "orientationchange", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "waiting"];
/**
* All Events combined
*/
declare const allEvents: ("blur" | "focus" | "focusin" | "focusout" | "mousedown" | "dblclick" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup" | "click" | "wheel" | "mousewheel" | "input" | "invalid" | "change" | "reset" | "select" | "submit" | "keydown" | "keypress" | "keyup" | "vrdisplayactivate" | "vrdisplayblur" | "vrdisplayconnect" | "vrdisplaydeactivate" | "vrdisplaydisconnect" | "vrdisplayfocus" | "vrdisplaypointerrestricted" | "vrdisplaypointerunrestricted" | "vrdisplaypresentchange" | "MSGestureChange" | "MSGestureDoubleTap" | "MSGestureEnd" | "MSGestureHold" | "MSGestureStart" | "MSGestureTap" | "MSInertiaStart" | "MSPointerCancel" | "MSPointerDown" | "MSPointerEnter" | "MSPointerLeave" | "MSPointerMove" | "MSPointerOut" | "MSPointerOver" | "MSPointerUp" | "afterprint" | "beforeprint" | "offline" | "online" | "canplay" | "canplaythrough" | "pause" | "play" | "playing" | "volumechange" | "compositionstart" | "compositionupdate" | "compositionend" | "pointerover" | "pointerenter" | "pointerdown" | "pointermove" | "pointerup" | "pointercancel" | "pointerout" | "pointerleave" | "gotpointercapture" | "lostpointercapture" | "touchstart" | "touchend" | "touchmove" | "touchcancel" | "drag" | "dragend" | "dragexit" | "dragenter" | "dragleave" | "dragover" | "dragstart" | "drop" | "contextmenu" | "resize" | "scroll" | "abort" | "load" | "loadeddata" | "loadedmetadata" | "loadstart" | "unload" | "error" | "close" | "message" | "open" | "compassneedscalibration" | "durationchange" | "emptied" | "ended" | "orientationchange" | "ratechange" | "seeked" | "seeking" | "stalled" | "suspend" | "timeupdate" | "waiting")[];
interface RxZoneGlobalDisableConfigurations {
/**
* Disable the monkey patch of the `Node.js` `EventEmitter` API.
*
* By default, `zone.js` monkey patches the `Node.js` `EventEmitter` APIs to make asynchronous
* 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');
* ```
*
* If you set `__Zone_disable_EventEmitter = true` before importing `zone.js`,
* `zone.js` does not monkey patch the `EventEmitter` APIs and the above code
* outputs 'an event occurred <root>'.
*/
EventEmitter?: boolean;
/**
* Disable the monkey patch of the `Node.js` `fs` API.
*
* By default, `zone.js` monkey patches `Node.js` `fs` APIs to make asynchronous callbacks of
* those APIs in the same zone when scheduled.
*
* 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'.
* });
* });
* ```
*
* If you set `__Zone_disable_fs = true` before importing `zone.js`,
* `zone.js` does not monkey patch the `fs` API and the above code
* outputs 'get stats occurred <root>'.
*/
fs?: boolean;
/**
* Disable the monkey patch of the `Node.js` `timer` API.
*
* By default, `zone.js` monkey patches the `Node.js` `timer` APIs to make asynchronous
* callbacks of those APIs in the same zone when scheduled.
*
* 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'.
* });
* });
* ```
*
* If you set `__Zone_disable_timers = true` before importing `zone.js`,
* `zone.js` does not monkey patch the `timer` APIs and the above code
* outputs 'timeout <root>'.
*/
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'.
* });
* });
* ```
*
* If you set `__Zone_disable_nextTick = true` before importing `zone.js`,
* `zone.js` does not monkey patch the `process.nextTick()` API and the above code
* outputs 'nextTick <root>'.
*/
nextTick?: boolean;
/**
* Disable the monkey patch of the `Node.js` `crypto` API.
*
* By default, `zone.js` monkey patches the `Node.js` `crypto` APIs to make asynchronous callbacks
* of those APIs in the same zone when called.
*
* 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'.
* });
* });
* ```
*
* If you set `__Zone_disable_crypto = true` before importing `zone.js`,
* `zone.js` does not monkey patch the `crypto` API and the above code
* outputs 'crypto <root>'.
*/
crypto?: boolean;
/**
* Disable the monkey patch of the `Object.defineProperty()` API.
*
* 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).
*
* 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.
*
* If you set `__Zone_disable_defineProperty = true` before importing `zone.js`,
* `zone.js` does not monkey patch the `Object.defineProperty()` API and does not
* modify desc.configurable to true.
*
*/
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).
*
* 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.
*
* 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});
* });
* ```
*
* When these callbacks are invoked, those callbacks will be in the zone when
* `registerElement()` is called.
*
* If you set `__Zone_disable_registerElement = true` before importing `zone.js`,
* `zone.js` does not monkey patch `registerElement()` API and the above code
* outputs '<root>'.
*/
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).
*
* 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
* 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'.
* });
* });
* ```
*
* 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>'.
*/
EventTargetLegacy?: boolean;
/**
* Disable the monkey patch of the browser `timer` APIs.
*
* By default, `zone.js` monkey patches browser timer
* APIs (`setTimeout()`/`setInterval()`/`setImmediate()`) to make asynchronous callbacks of those
* APIs in the same zone when scheduled.
*
* 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'.
* });
* });
* ```
*
* If you set `__Zone_disable_timers = true` before importing `zone.js`,
* `zone.js` does not monkey patch `timer` API and the above code
* outputs 'timeout <root>'.
*
*/
timers?: boolean;
/**
* Disable the monkey patch of the browser `requestAnimationFrame()` API.
*
* By default, `zone.js` monkey patches the browser `requestAnimationFrame()` API
* to make the asynchronous callback of the `requestAnimationFrame()` in the same zone when
* scheduled.
*
* 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'
* });
* });
* ```
*
* If you set `__Zone_disable_requestAnimationFrame = true` before importing `zone.js`,
* `zone.js` does not monkey patch the `requestAnimationFrame()` API and the above code
* outputs 'raf <root>'.
*/
requestAnimationFrame?: boolean;
/**
*
* Disable the monkey patch of the browser blocking APIs(`alert()`/`prompt()`/`confirm()`).
*/
blocking?: boolean;
/**
* Disable the monkey patch of the browser `EventTarget` APIs.
*
* By default, `zone.js` monkey patches EventTarget APIs. The callbacks of the
* `addEventListener()` run in the same zone when the `addEventListener()` is called.
*
* 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'.
* });
* });
* ```
*
* If you set `__Zone_disable_EventTarget = true` before importing `zone.js`,
* `zone.js` does not monkey patch EventTarget API and the above code
* outputs 'clicked <root>'.
*
*/
EventTarget?: boolean;
/**
* Disable the monkey patch of the browser `FileReader` APIs.
*/
FileReader?: boolean;
/**
* Disable the monkey patch of the browser `MutationObserver` APIs.
*/
MutationObserver?: boolean;
/**
* Disable the monkey patch of the browser `IntersectionObserver` APIs.
*/
IntersectionObserver?: boolean;
/**
* Disable the monkey patch of the browser onProperty APIs(such as onclick).
*
* 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.
*
* 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'
* }
* });
* ```
*
* If you set `__Zone_disable_on_property = true` before importing `zone.js`,
* `zone.js` does not monkey patch onXXX properties and the above code
* outputs 'clicked <root>'.
*
*/
on_property?: boolean;
/**
* Disable the monkey patch of the browser `customElements` APIs.
*
* By default, `zone.js` monkey patches `customElements` APIs to make callbacks run in the
* same zone when the `customElements.define()` is called.
*
* 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.
*
* If you set `__Zone_disable_customElements = true` before importing `zone.js`,
* `zone.js` does not monkey patch `customElements` APIs and the above code
* runs inside <root> zone.
*/
customElements?: boolean;
/**
* Disable the monkey patch of the browser `XMLHttpRequest` APIs.
*
* By default, `zone.js` monkey patches `XMLHttpRequest` APIs to make XMLHttpRequest act
* 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();
* });
* ```
*
* 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'.
*
* If you set `__Zone_disable_XHR = true` before importing `zone.js`,
* `zone.js` does not monkey patch `XMLHttpRequest` APIs and the above onScheduleTask callback
* will not be called.
*
*/
XHR?: boolean;
/**
* Disable the monkey patch of the browser geolocation APIs.
*
* By default, `zone.js` monkey patches geolocation APIs to make callbacks run in the same zone
* 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'.
* }
* });
* ```
*
* If set you `__Zone_disable_geolocation = true` before importing `zone.js`,
* `zone.js` does not monkey patch geolocation APIs and the above code
* outputs 'getCurrentPosition <root>'.
*
*/
geolocation?: boolean;
/**
* Disable the monkey patch of the browser `canvas` APIs.
*
* By default, `zone.js` monkey patches `canvas` APIs to make callbacks run in the same zone when
* 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'.
* }
* });
* ```
*
* If you set `__Zone_disable_canvas = true` before importing `zone.js`,
* `zone.js` does not monkey patch `canvas` APIs and the above code
* outputs 'canvas.toBlob <root>'.
*/
canvas?: boolean;
/**
* Disable the `Promise` monkey patch.
*
* By default, `zone.js` monkey patches `Promise` APIs to make the `then()/catch()` callbacks in
* the same zone when those callbacks are called.
*
* 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'.
* });
* });
* ```
*
* If you set `__Zone_disable_ZoneAwarePromise = true` before importing `zone.js`,
* `zone.js` does not monkey patch `Promise` APIs and the above code
* outputs 'promise then callback <root>'.
*/
ZoneAwarePromise?: boolean;
}
type RxZoneGlobalDisableConfigurationsKey = keyof RxZoneGlobalDisableConfigurations;
interface RxZoneGlobalEventsConfigurations {
/**
* Define event names that users don't want monkey patched by the `zone.js`.
*
* By default, `zone.js` monkey patches EventTarget.addEventListener(). The event listener
* callback runs in the same zone when the addEventListener() is called.
*
* 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.
*
* Users can achieve this goal by defining `__zone_symbol__UNPATCHED_EVENTS = ['scroll',
* 'mousemove'];` before importing `zone.js`.
*/
UNPATCHED_EVENTS?: string[];
/**
* Define the event names of the passive listeners.
*
* To add passive event listeners, you can use `elem.addEventListener('scroll', listener,
* {passive: true});` or implement your own `EventManagerPlugin`.
*
* You can also define a global variable as follows:
*
* ```
* __zone_symbol__PASSIVE_EVENTS = ['scroll'];
* ```
*
* The preceding code makes all scroll event listeners passive.
*/
PASSIVE_EVENTS?: string[];
}
type RxZoneGlobalEventsConfigurationsKey = keyof RxZoneGlobalEventsConfigurations;
interface RxZoneGlobalSettingsConfigurations {
/**
* 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.
*/
DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION?: boolean;
}
type RxZoneGlobalSettingsConfigurationsKey = keyof RxZoneGlobalSettingsConfigurations;
interface RxZoneRuntimeConfigurations$1 {
ignoreConsoleErrorUncaughtError?: boolean;
}
type RxZoneRuntimeConfigurationsKey = keyof RxZoneRuntimeConfigurations$1;
interface RxZoneTestDisableConfigurations {
/**
* Disable the Jasmine integration.
*
* In the `zone-testing.js` bundle, by default, `zone-testing.js` monkey patches Jasmine APIs
* to make Jasmine APIs run in specified zone.
*
* 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.
*
* With this patch, `async()`/`fakeAsync()` can work with the Jasmine runner.
*
* 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.
*/
jasmine?: boolean;
/**
* Disable the Mocha integration.
*
* 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.
*
* 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.
*
* With this patch, `async()`/`fakeAsync()` can work with the Mocha runner.
*
* 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.
*/
mocha?: boolean;
/**
* Disable the Jest integration.
*
* In the `zone-testing.js` bundle, by default, `zone-testing.js` monkey patches Jest APIs
* to make Jest APIs run in the specified zone.
*
* 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.
*
* With this patch, `async()`/`fakeAsync()` can work with the Jest runner.
*
* 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.
*/
jest?: boolean;
}
type RxZoneTestDisableConfigurationsKey = keyof RxZoneTestDisableConfigurations;
interface RxZoneTestSettingsConfigurations {
/**
* Disable monkey patch the jasmine clock APIs.
*
* By default, `zone-testing.js` monkey patches the `jasmine.clock()` API,
* 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();
* }));
* });
* ```
*
* In the `fakeAsync()` method, `jasmine.clock().tick()` works just like `tick()`.
*
* If you set `__zone_symbol__fakeAsyncDisablePatchingClock = true` before importing
* `zone-testing.js`,`zone-testing.js` does not monkey patch the `jasmine.clock()` APIs and the
* `jasmine.clock()` cannot work with `fakeAsync()` any longer.
*/
fakeAsyncDisablePatchingClock?: boolean;
/**
* Enable auto running into `fakeAsync()` when installing the `jasmine.clock()`.
*
* By default, `zone-testing.js` does not automatically run into `fakeAsync()`
* 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();
* }));
* });
* ```
*
* You must run `fakeAsync()` to make test cases in the `FakeAsyncTestZone`.
*
* If you set `__zone_symbol__fakeAsyncAutoFakeAsyncWhenClockPatched = true` before importing
* `zone-testing.js`, `zone-testing.js` can run test case automatically in the
* `FakeAsyncTestZone` without calling the `fakeAsync()`.
*
* 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();
* });
* });
* ```
*
*/
fakeAsyncAutoFakeAsyncWhenClockPatched?: boolean;
/**
* Enable waiting for the unresolved promise in the `async()` test.
*
* 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.
*
* Consider the following example:
*
* ```
* describe('wait never resolved promise', () => {
* it('async with never resolved promise test', async(() => {
* const p = new Promise(() => {});
* p.then(() => {
* // do some expectation.
* });
* }))
* });
* ```
*
* 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.
*
* If you set `__zone_symbol__supportWaitUnResolvedChainedPromise = true`, the above case
* times out, because `async()` will wait for the unresolved promise.
*/
supportWaitUnResolvedChainedPromise?: boolean;
}
type RxZoneTestSettingsConfigurationsKey = keyof RxZoneTestSettingsConfigurations;
interface RxZoneFlagsHelperFunctions {
/**
* Logs all zone.js configurations in the console.
*/
__rxa_zone_config__log?: () => void;
}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* 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
*/
/**
* Additional `EventTarget` methods added by `Zone.js`.
*
* 1. removeAllListeners, remove all event listeners of the given event name.
* 2. eventListeners, get all event listeners of the given event name.
*/
interface EventTarget {
/**
*
* Remove all event listeners by name for this event target.
*
* This method is optional because it may not be available if you use `noop zone` when
* bootstrapping Angular application or disable the `EventTarget` monkey patch by `zone.js`.
*
* If the `eventName` is provided, will remove event listeners of that name.
* If the `eventName` is not provided, will remove all event listeners associated with
* `EventTarget`.
*
* @param eventName the name of the event, such as `click`. This parameter is optional.
*/
removeAllListeners?(eventName?: string): void;
/**
*
* Retrieve all event listeners by name.
*
* This method is optional because it may not be available if you use `noop zone` when
* bootstrapping Angular application or disable the `EventTarget` monkey patch by `zone.js`.
*
* If the `eventName` is provided, will return an array of event handlers or event listener
* objects of the given event.
* If the `eventName` is not provided, will return all listeners.
*
* @param eventName the name of the event, such as click. This parameter is optional.
*/
eventListeners?(eventName?: string): EventListenerOrEventListenerObject[];
}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* 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
*/
/**
* Interface of `zone.js` configurations.
*
* You can define the following configurations on the `window/global` object before
* importing `zone.js` to change `zone.js` default behaviors.
*/
interface RxZoneGlobalConfigurations {
/**
* Disable the monkey patch of the `Node.js` `EventEmitter` API.
*
* By default, `zone.js` monkey patches the `Node.js` `EventEmitter` APIs to make asynchronous
* callbacks of those APIs in the same zone when scheduled.
*
* Consider the following example:
*
* ```
* const EventEmitter = require('unpatch');
* 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');
* ```
*
* If you set `__Zone_disable_EventEmitter = true` before importing `zone.js`,
* `zone.js` does not monkey patch the `EventEmitter` APIs and the above code
* outputs 'an event occurred <root>'.
*/
__Zone_disable_EventEmitter?: boolean;
/**
* Disable the monkey patch of the `Node.js` `fs` API.
*
* By default, `zone.js` monkey patches `Node.js` `fs` APIs to make asynchronous callbacks of
* those APIs in the same zone when scheduled.
*
* 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'.
* });
* });
* ```
*
* If you set `__Zone_disable_fs = true` before importing `zone.js`,
* `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.
*
* By default, `zone.js` monkey patches the `Node.js` `timer` APIs to make asynchronous
* callbacks of those APIs in the same zone when scheduled.
*
* 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'.
* });
* });
* ```
*
* If you set `__Zone_disable_timers = true` before importing `zone.js`,
* `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'.
* });
* });
* ```
*
* If you set `__Zone_disable_nextTick = true` before importing `zone.js`,
* `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.
*
* By default, `zone.js` monkey patches the `Node.js` `crypto` APIs to make asynchronous callbacks
* of those APIs in the same zone when called.
*
* 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'.
* });
* });
* ```
*
* If you set `__Zone_disable_crypto = true` before importing `zone.js`,
* `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.
*
* 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).
*
* 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.
*
* If you set `__Zone_disable_defineProperty = true` before importing `zone.js`,
* `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).
*
* 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.
*
* 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});
* });
* ```
*
* When these callbacks are invoked, those callbacks will be in the zone when
* `registerElement()` is called.
*
* If you set `__Zone_disable_registerElement = true` before importing `zone.js`,
* `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).
*
* 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
* 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'.
* });
* });
* ```
*
* 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>'.
*/
__Zone_disable_EventTargetLegacy?: boolean;
/**
* Disable the monkey patch of the browser `timer` APIs.
*
* By default, `zone.js` monkey patches browser timer
* APIs (`setTimeout()`/`setInterval()`/`setImmediate()`) to make asynchronous callbacks of those
* APIs in the same zone when scheduled.
*
* 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'.
* });
* });
* ```
*
* If you set `__Zone_disable_timers = true` before importing `zone.js`,
* `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.
*
* By default, `zone.js` monkey patches the browser `requestAnimationFrame()` API
* to make the asynchronous callback of the `requestAnimationFrame()` in the same zone when
* scheduled.
*
* 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'
* });
* });
* ```
*
* If you set `__Zone_disable_requestAnimationFrame = true` before importing `zone.js`,
* `zone.js` does not monkey patch the `requestAnimationFrame()` API and the above code
* outputs 'raf <root>'.
*/
__Zone_disable_requestAnimationFrame?: boolean;
/**
*
* 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.
*
* By default, `zone.js` monkey patches EventTarget APIs. The callbacks of the
* `addEventListener()` run in the same zone when the `addEventListener()` is called.
*
* 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'.
* });
* });
* ```
*
* If you set `__Zone_disable_EventTarget = true` before importing `zone.js`,
* `zone.js` does not monkey patch EventTarget API and the above code
* outputs 'clicked <root>'.
*
*/
__Zone_disable_EventTarget?: boolean;
/**
* 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;
/**
* Disable the monkey patch of the browser onProperty APIs(such as onclick).
*
* 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.
*
* 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'
* }
* });
* ```
*
* If you set `__Zone_disable_on_property = true` before importing `zone.js`,
* `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.
*
* By default, `zone.js` monkey patches `customElements` APIs to make callbacks run in the
* same zone when the `customElements.define()` is called.
*
* 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.
*
* If you set `__Zone_disable_customElements = true` before importing `zone.js`,
* `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.
*
* By default, `zone.js` monkey patches `XMLHttpRequest` APIs to make XMLHttpRequest act
* 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();
* });
* ```
*
* 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'.
*
* If you set