zone.js
Advanced tools
Comparing version 0.8.10 to 0.8.11
@@ -0,1 +1,15 @@ | ||
<a name="0.8.11"></a> | ||
## [0.8.11](https://github.com/angular/zone.js/compare/v0.8.10...0.8.11) (2017-05-19) | ||
### Bug Fixes | ||
* **closure:** patchOnProperty with exact eventNames as possible ([#768](https://github.com/angular/zone.js/issues/768)) ([582ff7b](https://github.com/angular/zone.js/commit/582ff7b)) | ||
* **patch:** fix [#744](https://github.com/angular/zone.js/issues/744), add namespace to load patch name ([#774](https://github.com/angular/zone.js/issues/774)) ([89f990a](https://github.com/angular/zone.js/commit/89f990a)) | ||
* **task:** fix [#778](https://github.com/angular/zone.js/issues/778), sometimes task will run after being canceled ([#780](https://github.com/angular/zone.js/issues/780)) ([b7238c8](https://github.com/angular/zone.js/commit/b7238c8)) | ||
* **webcomponents:** fix [#782](https://github.com/angular/zone.js/issues/782), fix conflicts with shadydom of webcomponents ([#784](https://github.com/angular/zone.js/issues/784)) ([245f8e9](https://github.com/angular/zone.js/commit/245f8e9)) | ||
* **webpack:** access `process` through `_global` so that WebPack does not accidently browserify ([#786](https://github.com/angular/zone.js/issues/786)) ([1919b36](https://github.com/angular/zone.js/commit/1919b36)) | ||
<a name="0.8.10"></a> | ||
@@ -2,0 +16,0 @@ ## [0.8.10](https://github.com/angular/zone.js/compare/v0.8.9...0.8.10) (2017-05-03) |
@@ -25,4 +25,3 @@ /** | ||
} | ||
var patchEventTargetMethods = Zone[Zone.__symbol__('patchEventTargetMethods')]; | ||
patchEventTargetMethods(_global['MediaQueryList'].prototype, 'addListener', 'removeListener', function (self, args) { | ||
api.patchEventTargetMethods(_global['MediaQueryList'].prototype, 'addListener', 'removeListener', function (self, args) { | ||
return { | ||
@@ -29,0 +28,0 @@ useCapturing: false, |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(this,function(){"use strict";Zone.__load_patch("mediaQuery",function(e,t,n){if(e.MediaQueryList){var i=t[t.__symbol__("patchEventTargetMethods")];i(_global.MediaQueryList.prototype,"addListener","removeListener",function(t,n){return{useCapturing:!1,eventName:"mediaQuery",handler:n[0],target:t||e,name:"mediaQuery",invokeAddFunc:function(e,t){return t&&t.invoke?this.target[e](t.invoke):this.target[e](t)},invokeRemoveFunc:function(e,t){return t&&t.invoke?this.target[e](t.invoke):this.target[e](t)}}})}})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(this,function(){"use strict";Zone.__load_patch("mediaQuery",function(e,t,n){e.MediaQueryList&&n.patchEventTargetMethods(_global.MediaQueryList.prototype,"addListener","removeListener",function(t,n){return{useCapturing:!1,eventName:"mediaQuery",handler:n[0],target:t||e,name:"mediaQuery",invokeAddFunc:function(e,t){return t&&t.invoke?this.target[e](t.invoke):this.target[e](t)},invokeRemoveFunc:function(e,t){return t&&t.invoke?this.target[e](t.invoke):this.target[e](t)}}})})}); |
@@ -30,6 +30,5 @@ /** | ||
} | ||
var patchOnProperties = Zone[Zone.__symbol__('patchOnProperties')]; | ||
patchOnProperties(Notification.prototype, null); | ||
api.patchOnProperties(Notification.prototype, null); | ||
}); | ||
}))); |
@@ -1,1 +0,1 @@ | ||
!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(this,function(){"use strict";Zone.__load_patch("notification",function(o,t,e){var n=_global.Notification;if(n&&n.prototype){var i=Object.getOwnPropertyDescriptor(n.prototype,"onerror");if(i&&i.configurable){var r=t[t.__symbol__("patchOnProperties")];r(n.prototype,null)}}})}); | ||
!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(this,function(){"use strict";Zone.__load_patch("notification",function(o,t,e){var n=_global.Notification;if(n&&n.prototype){var i=Object.getOwnPropertyDescriptor(n.prototype,"onerror");i&&i.configurable&&e.patchOnProperties(n.prototype,null)}})}); |
@@ -1,1 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(this,function(){"use strict";function e(e,t){for(var n=e.length-1;n>=0;n--)"function"==typeof e[n]&&(e[n]=Zone.current.wrap(e[n],t+"_"+n));return e}function t(t,n){for(var r=t.constructor.name,o=function(o){var a=n[o],i=t[a];i&&(t[a]=function(t){var n=function(){return t.apply(this,e(arguments,r+"."+a))};return f(n,t),n}(i))},a=0;a<n.length;a++)o(a)}function n(e,t){var n=Object.getOwnPropertyDescriptor(e,t)||{enumerable:!0,configurable:!0};if(n.configurable){delete n.writable,delete n.value;var r=n.get,o=t.substr(2),a=D("_"+t);n.set=function(t){var n=this;if(n||e!==S||(n=S),n){var r=n[a];if(r&&n.removeEventListener(o,r),"function"==typeof t){var i=function(e){var n=t.apply(this,arguments);return void 0==n||n||e.preventDefault(),n};n[a]=i,n.addEventListener(o,i,!1)}else n[a]=null}},n.get=function(){var o=this;if(o||e!==S||(o=S),!o)return null;if(o.hasOwnProperty(a))return o[a];if(r){var i=r&&r.apply(this);if(i)return n.set.apply(this,[i]),"function"==typeof o.removeAttribute&&o.removeAttribute(t),i}return null},Object.defineProperty(e,t,n)}}function r(e,t){if(t)for(var r=0;r<t.length;r++)n(e,"on"+t[r]);else{var o=[];for(var a in e)"on"==a.substr(0,2)&&o.push(a);for(var i=0;i<o.length;i++)n(e,o[i])}}function o(e,t){var n="boolean"==typeof e?e:"object"==typeof e&&(e&&e.capture),r="boolean"==typeof t?t:"object"==typeof t&&(t&&t.capture);return!!n==!!r}function a(e,t,n,r,a){var i=e[C];if(i)for(var s=0;s<i.length;s++){var c=i[s],u=c.data,l=u.handler;if((u.handler===t||l.listener===t)&&o(u.options,r)&&u.eventName===n)return a&&i.splice(s,1),c}return null}function i(e,t,n){var r=e[C];r||(r=e[C]=[]),n?r.unshift(t):r.push(t)}function s(e,t,n,r,o,s){function c(e){var t=e.data;return i(t.target,e,o),t.invokeAddFunc(l,e)}function u(e){var t=e.data;return a(t.target,e.invoke,t.eventName,t.options,!0),t.invokeRemoveFunc(h,e)}void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===s&&(s=F);var l=D(e),h=D(t),p=!n&&void 0;return function(t,n){var o=s(t,n);o.options=o.options||p;var i=null;"function"==typeof o.handler?i=o.handler:o.handler&&o.handler.handleEvent&&(i=function(e){return o.handler.handleEvent(e)});var h=!1;try{h=o.handler&&"[object FunctionWrapper]"===o.handler.toString()}catch(f){return o.crossContext=!0,o.invokeAddFunc(l,o.handler)}if(!i||h)return o.invokeAddFunc(l,o.handler);if(!r){var d=a(o.target,o.handler,o.eventName,o.options,!1);if(d)return o.invokeAddFunc(l,d)}var v=Zone.current,y=o.target.constructor.name+"."+e+":"+o.eventName;v.scheduleEventTask(y,i,o,c,u)}}function c(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=F);var r=D(e),o=!t&&void 0;return function(e,t){var i=n(e,t);i.options=i.options||o;var s=null;"function"==typeof i.handler?s=i.handler:i.handler&&i.handler.handleEvent&&(s=function(e){return i.handler.handleEvent(e)});var c=!1;try{c=i.handler&&"[object FunctionWrapper]"===i.handler.toString()}catch(u){return i.crossContext=!0,i.invokeRemoveFunc(r,i.handler)}if(!s||c)return i.invokeRemoveFunc(r,i.handler);var l=a(i.target,i.handler,i.eventName,i.options,!0);l?l.zone.cancelTask(l):i.invokeRemoveFunc(r,i.handler)}}function u(e,t,n,r){return void 0===t&&(t=I),void 0===n&&(n=M),void 0===r&&(r=F),!(!e||!e[t])&&(h(e,t,function(){return s(t,n,!0,!1,!1,r)}),h(e,n,function(){return c(n,!0,r)}),!0)}function l(t){var n=S[t];if(n){S[D(t)]=n,S[t]=function(){var r=e(arguments,t);switch(r.length){case 0:this[H]=new n;break;case 1:this[H]=new n(r[0]);break;case 2:this[H]=new n(r[0],r[1]);break;case 3:this[H]=new n(r[0],r[1],r[2]);break;case 4:this[H]=new n(r[0],r[1],r[2],r[3]);break;default:throw new Error("Arg list too long.")}},f(S[t],n);var r,o=new n(function(){});for(r in o)"XMLHttpRequest"===t&&"responseBlob"===r||!function(e){"function"==typeof o[e]?S[t].prototype[e]=function(){return this[H][e].apply(this[H],arguments)}:Object.defineProperty(S[t].prototype,e,{set:function(n){"function"==typeof n?(this[H][e]=Zone.current.wrap(n,t+"."+e),f(this[H][e],n)):this[H][e]=n},get:function(){return this[H][e]}})}(r);for(r in n)"prototype"!==r&&n.hasOwnProperty(r)&&(S[t][r]=n[r])}}function h(e,t,n){for(var r=e;r&&!r.hasOwnProperty(t);)r=Object.getPrototypeOf(r);!r&&e[t]&&(r=e);var o,a=D(t);if(r&&!(o=r[a])){o=r[a]=r[t];var i=n(o,a,t);r[t]=function(){return i(this,arguments)},f(r[t],o)}return o}function p(e,t){var n=e[D("eventTasks")],r=[];if(n)for(var o=0;o<n.length;o++){var a=n[o],i=a.data,s=i&&i.eventName;s===t&&r.push(a)}return r}function f(e,t){e[D("OriginalDelegate")]=t}function d(e,t,n,r){function o(t){function n(){try{t.invoke.apply(this,arguments)}finally{"number"==typeof r.handleId&&delete c[r.handleId]}}var r=t.data;return r.args[0]=n,r.handleId=i.apply(e,r.args),"number"==typeof r.handleId&&(c[r.handleId]=t),t}function a(e){return"number"==typeof e.data.handleId&&delete c[e.data.handleId],s(e.data.handleId)}var i=null,s=null;t+=r,n+=r;var c={};i=h(e,t,function(n){return function(i,s){if("function"==typeof s[0]){var c=Zone.current,u={handleId:null,isPeriodic:"Interval"===r,delay:"Timeout"===r||"Interval"===r?s[1]||0:null,args:s},l=c.scheduleMacroTask(t,s[0],u,o,a);if(!l)return l;var h=l.data.handleId;return h&&h.ref&&h.unref&&"function"==typeof h.ref&&"function"==typeof h.unref&&(l.ref=h.ref.bind(h),l.unref=h.unref.bind(h)),l}return n.apply(e,s)}}),s=h(e,n,function(t){return function(n,r){var o="number"==typeof r[0]?c[r[0]]:r[0];o&&"string"==typeof o.type?"notScheduled"!==o.state&&(o.cancelFn&&o.data.isPeriodic||0===o.runCount)&&o.zone.cancelTask(o):t.apply(e,r)}})}function v(){Object.defineProperty=function(e,t,n){if(k(e,t))throw new TypeError("Cannot assign to read only property '"+t+"' of "+e);var r=n.configurable;return"prototype"!==t&&(n=g(e,t,n)),_(e,t,n,r)},Object.defineProperties=function(e,t){return Object.keys(t).forEach(function(n){Object.defineProperty(e,n,t[n])}),e},Object.create=function(e,t){return"object"!=typeof t||Object.isFrozen(t)||Object.keys(t).forEach(function(n){t[n]=g(e,n,t[n])}),q(e,t)},Object.getOwnPropertyDescriptor=function(e,t){var n=R(e,t);return k(e,t)&&(n.configurable=!1),n}}function y(e,t,n){var r=n.configurable;return n=g(e,t,n),_(e,t,n,r)}function k(e,t){return e&&e[x]&&e[x][t]}function g(e,t,n){return n.configurable=!0,n.configurable||(e[x]||L(e,x,{writable:!0,value:{}}),e[x][t]=!0),n}function _(e,t,n,r){try{return L(e,t,n)}catch(o){if(!n.configurable)throw o;"undefined"==typeof r?delete n.configurable:n.configurable=r;try{return L(e,t,n)}catch(o){var a=null;try{a=JSON.stringify(n)}catch(o){a=a.toString()}console.log("Attempting to configure '"+t+"' with descriptor '"+a+"' on object '"+e+"' and got error, giving up: "+o)}}}function m(e){var t=[],n=e.wtf;n?t=A.split(",").map(function(e){return"HTML"+e+"Element"}).concat(B):e[X]?t.push(X):t=B;for(var r=0;r<t.length;r++){var o=e[t[r]];u(o&&o.prototype)}}function T(e){var t=e.WebSocket;e.EventTarget||u(t.prototype),e.WebSocket=function(e,n){var o,a=arguments.length>1?new t(e,n):new t(e),i=Object.getOwnPropertyDescriptor(a,"onmessage");return i&&i.configurable===!1?(o=Object.create(a),["addEventListener","removeEventListener","send","close"].forEach(function(e){o[e]=function(){return a[e].apply(a,arguments)}})):o=a,r(o,["close","error","message","open"]),o};for(var n in t)e.WebSocket[n]=t[n]}function b(e){if(!P||j){var t="undefined"!=typeof WebSocket;w()?(O&&(r(window,N.concat(["resize"])),r(Document.prototype,N),"undefined"!=typeof window.SVGElement&&r(window.SVGElement.prototype,N),r(HTMLElement.prototype,N)),r(XMLHttpRequest.prototype,null),"undefined"!=typeof IDBIndex&&(r(IDBIndex.prototype,null),r(IDBRequest.prototype,null),r(IDBOpenDBRequest.prototype,null),r(IDBDatabase.prototype,null),r(IDBTransaction.prototype,null),r(IDBCursor.prototype,null)),t&&r(WebSocket.prototype,null)):(E(),l("XMLHttpRequest"),t&&T(e))}}function w(){if((O||j)&&!Object.getOwnPropertyDescriptor(HTMLElement.prototype,"onclick")&&"undefined"!=typeof Element){var e=Object.getOwnPropertyDescriptor(Element.prototype,"onclick");if(e&&!e.configurable)return!1}var t=Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype,"onreadystatechange");if(t){Object.defineProperty(XMLHttpRequest.prototype,"onreadystatechange",{enumerable:!0,configurable:!0,get:function(){return!0}});var n=new XMLHttpRequest,r=!!n.onreadystatechange;return Object.defineProperty(XMLHttpRequest.prototype,"onreadystatechange",t||{}),r}Object.defineProperty(XMLHttpRequest.prototype,"onreadystatechange",{enumerable:!0,configurable:!0,get:function(){return this[D("fakeonreadystatechange")]},set:function(e){this[D("fakeonreadystatechange")]=e}});var n=new XMLHttpRequest,o=function(){};n.onreadystatechange=o;var r=n[D("fakeonreadystatechange")]===o;return n.onreadystatechange=null,r}function E(){for(var e=function(e){var t=N[e],n="on"+t;self.addEventListener(t,function(e){var t,r,o=e.target;for(r=o?o.constructor.name+"."+n:"unknown."+n;o;)o[n]&&!o[n][W]&&(t=Zone.current.wrap(o[n],r),t[W]=o[n],o[n]=t),o=o.parentElement},!0)},t=0;t<N.length;t++)e(t)}function Z(e){if((O||j)&&"registerElement"in e.document){var t=document.registerElement,n=["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"];document.registerElement=function(e,r){return r&&r.prototype&&n.forEach(function(e){var t="Document.registerElement::"+e;if(r.prototype.hasOwnProperty(e)){var n=Object.getOwnPropertyDescriptor(r.prototype,e);n&&n.value?(n.value=Zone.current.wrap(n.value,t),y(r.prototype,e,n)):r.prototype[e]=Zone.current.wrap(r.prototype[e],t)}else r.prototype[e]&&(r.prototype[e]=Zone.current.wrap(r.prototype[e],t))}),t.apply(document,[e,r])},f(document.registerElement,t)}}(function(e){function t(e){s&&s.mark&&s.mark(e)}function n(e,t){s&&s.measure&&s.measure(e,t)}function r(t){0===j&&0===v.length&&(e[f]?e[f].resolve(0)[d](o):e[p](o,0)),t&&v.push(t)}function o(){if(!y){for(y=!0;v.length;){var e=v;v=[];for(var t=0;t<e.length;t++){var n=e[t];try{n.zone.runTask(n,null,null)}catch(r){z.onUnhandledError(r)}}}!c[i("ignoreConsoleErrorUncaughtError")];z.microtaskDrainDone(),y=!1}}function a(){}function i(e){return"__zone_symbol__"+e}var s=e.performance;if(t("Zone"),e.Zone)throw new Error("Zone already loaded.");var c=function(){function r(e,t){this._properties=null,this._parent=e,this._name=t?t.name||"unnamed":"<root>",this._properties=t&&t.properties||{},this._zoneDelegate=new l(this,this._parent&&this._parent._zoneDelegate,t)}return r.assertZonePatched=function(){if(e.Promise!==S.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")},Object.defineProperty(r,"root",{get:function(){for(var e=r.current;e.parent;)e=e.parent;return e},enumerable:!0,configurable:!0}),Object.defineProperty(r,"current",{get:function(){return P.zone},enumerable:!0,configurable:!0}),Object.defineProperty(r,"currentTask",{get:function(){return O},enumerable:!0,configurable:!0}),r.__load_patch=function(o,a){if(S.hasOwnProperty(o))throw Error("Already loaded patch: "+o);if(!e["__Zone_disable_"+o]){var i="Zone:"+o;t(i),S[o]=a(e,r,z),n(i,i)}},Object.defineProperty(r.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),r.prototype.get=function(e){var t=this.getZoneWith(e);if(t)return t._properties[e]},r.prototype.getZoneWith=function(e){for(var t=this;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null},r.prototype.fork=function(e){if(!e)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)},r.prototype.wrap=function(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);var n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}},r.prototype.run=function(e,t,n,r){void 0===t&&(t=void 0),void 0===n&&(n=null),void 0===r&&(r=null),P={parent:P,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{P=P.parent}},r.prototype.runGuarded=function(e,t,n,r){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null),P={parent:P,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(o){if(this._zoneDelegate.handleError(this,o))throw o}}finally{P=P.parent}},r.prototype.runTask=function(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(e.zone||k).name+"; Execution: "+this.name+")");var r=e.state!=T;r&&e._transitionTo(T,m),e.runCount++;var o=O;O=e,P={parent:P,zone:this};try{e.type==Z&&e.data&&!e.data.isPeriodic&&(e.cancelFn=null);try{return this._zoneDelegate.invokeTask(this,e,t,n)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}finally{e.state!==g&&e.state!==w&&(e.type==D||e.data&&e.data.isPeriodic?r&&e._transitionTo(m,T):(e.runCount=0,this._updateTaskCount(e,-1),r&&e._transitionTo(g,T,g))),P=P.parent,O=o}},r.prototype.scheduleTask=function(e){if(e.zone&&e.zone!==this)for(var t=this;t;){if(t===e.zone)throw Error("can not reschedule task to "+this.name+" which is descendants of the original zone "+e.zone.name);t=t.parent}e._transitionTo(_,g);var n=[];e._zoneDelegates=n,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(r){throw e._transitionTo(w,_,g),this._zoneDelegate.handleError(this,r),r}return e._zoneDelegates===n&&this._updateTaskCount(e,1),e.state==_&&e._transitionTo(m,_),e},r.prototype.scheduleMicroTask=function(e,t,n,r){return this.scheduleTask(new h(E,e,t,n,r,null))},r.prototype.scheduleMacroTask=function(e,t,n,r,o){return this.scheduleTask(new h(Z,e,t,n,r,o))},r.prototype.scheduleEventTask=function(e,t,n,r,o){return this.scheduleTask(new h(D,e,t,n,r,o))},r.prototype.cancelTask=function(e){if(e.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(e.zone||k).name+"; Execution: "+this.name+")");e._transitionTo(b,m,T);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(w,b),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(g,b),e.runCount=0,e},r.prototype._updateTaskCount=function(e,t){var n=e._zoneDelegates;t==-1&&(e._zoneDelegates=null);for(var r=0;r<n.length;r++)n[r]._updateTaskCount(e.type,t)},r}();c.__symbol__=i;var u={name:"",onHasTask:function(e,t,n,r){return e.hasTask(n,r)},onScheduleTask:function(e,t,n,r){return e.scheduleTask(n,r)},onInvokeTask:function(e,t,n,r,o,a){return e.invokeTask(n,r,o,a)},onCancelTask:function(e,t,n,r){return e.cancelTask(n,r)}},l=function(){function e(e,t,n){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this.zone=e,this._parentDelegate=t,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._forkCurrZone=n&&(n.onFork?this.zone:t.zone),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._interceptCurrZone=n&&(n.onIntercept?this.zone:t.zone),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._invokeCurrZone=n&&(n.onInvoke?this.zone:t.zone),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._handleErrorCurrZone=n&&(n.onHandleError?this.zone:t.zone),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._scheduleTaskCurrZone=n&&(n.onScheduleTask?this.zone:t.zone),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._invokeTaskCurrZone=n&&(n.onInvokeTask?this.zone:t.zone),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._cancelTaskCurrZone=n&&(n.onCancelTask?this.zone:t.zone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;var r=n&&n.onHasTask,o=t&&t._hasTaskZS;(r||o)&&(this._hasTaskZS=r?n:u,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=e,n.onScheduleTask||(this._scheduleTaskZS=u,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this.zone),n.onInvokeTask||(this._invokeTaskZS=u,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this.zone),n.onCancelTask||(this._cancelTaskZS=u,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this.zone))}return e.prototype.fork=function(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new c(e,t)},e.prototype.intercept=function(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,e,t,n):t},e.prototype.invoke=function(e,t,n,r,o){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,r,o):t.apply(n,r)},e.prototype.handleError=function(e,t){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t)},e.prototype.scheduleTask=function(e,t){var n=t;if(this._scheduleTaskZS)this._hasTaskZS&&n._zoneDelegates.push(this._hasTaskDlgtOwner),n=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,e,t),n||(n=t);else if(t.scheduleFn)t.scheduleFn(t);else{if(t.type!=E)throw new Error("Task is missing scheduleFn.");r(t)}return n},e.prototype.invokeTask=function(e,t,n,r){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,e,t,n,r):t.callback.apply(n,r)},e.prototype.cancelTask=function(e,t){var n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,e,t);else{if(!t.cancelFn)throw Error("Task is not cancelable");n=t.cancelFn(t)}return n},e.prototype.hasTask=function(e,t){try{return this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,e,t)}catch(n){this.handleError(e,n)}},e.prototype._updateTaskCount=function(e,t){var n=this._taskCounts,r=n[e],o=n[e]=r+t;if(o<0)throw new Error("More tasks executed then were scheduled.");if(0==r||0==o){var a={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};this.hasTask(this.zone,a)}},e}(),h=function(){function e(e,t,n,r,a,i){this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=e,this.source=t,this.data=r,this.scheduleFn=a,this.cancelFn=i,this.callback=n;var s=this;this.invoke=function(){j++;try{return s.runCount++,s.zone.runTask(s,this,arguments)}finally{1==j&&o(),j--}}}return Object.defineProperty(e.prototype,"zone",{get:function(){return this._zone},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),e.prototype.cancelScheduleRequest=function(){this._transitionTo(g,_)},e.prototype._transitionTo=function(e,t,n){if(this._state!==t&&this._state!==n)throw new Error(this.type+" '"+this.source+"': can not transition to '"+e+"', expecting state '"+t+"'"+(n?" or '"+n+"'":"")+", was '"+this._state+"'.");this._state=e,e==g&&(this._zoneDelegates=null)},e.prototype.toString=function(){return this.data&&"undefined"!=typeof this.data.handleId?this.data.handleId:Object.prototype.toString.call(this)},e.prototype.toJSON=function(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,invoke:this.invoke,scheduleFn:this.scheduleFn,cancelFn:this.cancelFn,runCount:this.runCount,callback:this.callback}},e}(),p=i("setTimeout"),f=i("Promise"),d=i("then"),v=[],y=!1,k={name:"NO ZONE"},g="notScheduled",_="scheduling",m="scheduled",T="running",b="canceling",w="unknown",E="microTask",Z="macroTask",D="eventTask",S={},z={symbol:i,currentZoneFrame:function(){return P},onUnhandledError:a,microtaskDrainDone:a,scheduleMicroTask:r,showUncaughtError:function(){return!c[i("ignoreConsoleErrorUncaughtError")]}},P={parent:null,zone:new c(null,null)},O=null,j=0;return n("Zone","Zone"),e.Zone=c})("undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global);Zone.__load_patch("ZoneAwarePromise",function(e,t,n){function r(e){n.onUnhandledError(e);try{var r=t[f("unhandledPromiseRejectionHandler")];r&&"function"==typeof r&&r.apply(this,[e])}catch(o){}}function o(e){return e&&e.then}function a(e){return e}function i(e){return Z.reject(e)}function s(e,t){return function(n){try{c(e,t,n)}catch(r){c(e,!1,r)}}}function c(e,r,o){var a=E();if(e===o)throw new TypeError("Promise resolved with itself");if(e[k]===m){var i=null;try{"object"!=typeof o&&"function"!=typeof o||(i=o&&o.then)}catch(h){return a(function(){c(e,!1,h)})(),e}if(r!==b&&o instanceof Z&&o.hasOwnProperty(k)&&o.hasOwnProperty(g)&&o[k]!==m)u(o),c(e,o[k],o[g]);else if(r!==b&&"function"==typeof i)try{i.apply(o,[a(s(e,r)),a(s(e,!1))])}catch(h){a(function(){c(e,!1,h)})()}else{e[k]=r;var p=e[g];e[g]=o,r===b&&o instanceof Error&&(o[f("currentTask")]=t.currentTask);for(var v=0;v<p.length;)l(e,p[v++],p[v++],p[v++],p[v++]);if(0==p.length&&r==b){e[k]=w;try{throw new Error("Uncaught (in promise): "+o+(o&&o.stack?"\n"+o.stack:""))}catch(h){var y=h;y.rejection=o,y.promise=e,y.zone=t.current,y.task=t.currentTask,d.push(y),n.scheduleMicroTask()}}}}return e}function u(e){if(e[k]===w){try{var n=t[f("rejectionHandledHandler")];n&&"function"==typeof n&&n.apply(this,[{rejection:e[g],promise:e}])}catch(r){}e[k]=b;for(var o=0;o<d.length;o++)e===d[o].promise&&d.splice(o,1)}}function l(e,t,n,r,o){u(e);var s=e[k]?"function"==typeof r?r:a:"function"==typeof o?o:i;t.scheduleMicroTask(_,function(){try{c(n,!0,t.run(s,void 0,[e[g]]))}catch(r){c(n,!1,r)}})}function h(e){var t=e.prototype,n=t.then;t[y]=n,e.prototype.then=function(e,t){var r=this,o=new Z(function(e,t){n.call(r,e,t)});return o.then(e,t)},e[S]=!0}function p(e){return function(){var t=e.apply(this,arguments);if(t instanceof Z)return t;var n=t.constructor;return n[S]||h(n),t}}var f=n.symbol,d=[],v=f("Promise"),y=f("then");n.onUnhandledError=function(e){if(n.showUncaughtError()){var t=e&&e.rejection;t&&console.error("Unhandled Promise rejection:",t instanceof Error?t.message:t,"; Zone:",e.zone.name,"; Task:",e.task&&e.task.source,"; Value:",t,t instanceof Error?t.stack:void 0),console.error(e)}},n.microtaskDrainDone=function(){for(;d.length;)for(var e=function(){var e=d.shift();try{e.zone.runGuarded(function(){throw e})}catch(t){r(t)}};d.length;)e()};var k=f("state"),g=f("value"),_="Promise.then",m=null,T=!0,b=!1,w=0,E=function(){var e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},Z=function(){function e(t){var n=this;if(!(n instanceof e))throw new Error("Must be an instanceof Promise.");n[k]=m,n[g]=[];try{t&&t(s(n,T),s(n,b))}catch(r){c(n,!1,r)}}return e.toString=function(){return"function ZoneAwarePromise() { [native code] }"},e.resolve=function(e){return c(new this(null),T,e)},e.reject=function(e){return c(new this(null),b,e)},e.race=function(e){function t(e){i&&(i=r(e))}function n(e){i&&(i=a(e))}for(var r,a,i=new this(function(e,t){n=[e,t],r=n[0],a=n[1];var n}),s=0,c=e;s<c.length;s++){var u=c[s];o(u)||(u=this.resolve(u)),u.then(t,n)}return i},e.all=function(e){for(var t,n,r=new this(function(e,r){t=e,n=r}),a=0,i=[],s=0,c=e;s<c.length;s++){var u=c[s];o(u)||(u=this.resolve(u)),u.then(function(e){return function(n){i[e]=n,a--,a||t(i)}}(a),n),a++}return a||t(i),r},e.prototype.then=function(e,n){var r=new this.constructor(null),o=t.current;return this[k]==m?this[g].push(o,r,e,n):l(this,o,r,e,n),r},e.prototype["catch"]=function(e){return this.then(null,e)},e}();Z.resolve=Z.resolve,Z.reject=Z.reject,Z.race=Z.race,Z.all=Z.all;var D=e[v]=e.Promise;e.Promise=Z;var S=f("thenPatched");if(D){h(D);var z=e.fetch;"function"==typeof z&&(e.fetch=p(z))}return Promise[t.__symbol__("uncaughtPromiseErrors")]=d,Z});var D=function(e){return"__zone_symbol__"+e},S="object"==typeof window&&window||"object"==typeof self&&self||global,z="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,P=!("nw"in S)&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),O=!P&&!z&&!("undefined"==typeof window||!window.HTMLElement),j="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)&&!z&&!("undefined"==typeof window||!window.HTMLElement),C=D("eventTasks"),I="addEventListener",M="removeEventListener",F=function(e,t){return{options:t[2],eventName:t[0],handler:t[1],target:e||S,name:t[0],crossContext:!1,invokeAddFunc:function(e,t){if(!this.crossContext)return t&&t.invoke?this.target[e](this.eventName,t.invoke,this.options):this.target[e](this.eventName,t,this.options);try{return this.target[e](this.eventName,t,this.options)}catch(n){}},invokeRemoveFunc:function(e,t){if(!this.crossContext)return t&&t.invoke?this.target[e](this.eventName,t.invoke,this.options):this.target[e](this.eventName,t,this.options);try{return this.target[e](this.eventName,t,this.options)}catch(n){}}}},H=D("originalInstance");Zone[D("patchEventTargetMethods")]=u,Zone[D("patchOnProperties")]=r,Zone.__load_patch("toString",function(e,t,n){var r=Function.prototype.toString;Function.prototype.toString=function(){if("function"==typeof this){if(this[D("OriginalDelegate")])return r.apply(this[D("OriginalDelegate")],arguments);if(this===Promise){var t=e[D("Promise")];if(t)return r.apply(t,arguments)}if(this===Error){var n=e[D("Error")];if(n)return r.apply(n,arguments)}}return r.apply(this,arguments)};var o=Object.prototype.toString;Object.prototype.toString=function(){return this instanceof Promise?"[object Promise]":o.apply(this,arguments)}});var L=Object[D("defineProperty")]=Object.defineProperty,R=Object[D("getOwnPropertyDescriptor")]=Object.getOwnPropertyDescriptor,q=Object.create,x=D("unconfigurables"),A="Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video",B="ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Window,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex,WebSocket".split(","),X="EventTarget",N="copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror".split(" "),W=D("unbound");Zone.__load_patch("timers",function(e,t,n){var r="set",o="clear";d(e,r,o,"Timeout"),d(e,r,o,"Interval"),d(e,r,o,"Immediate"),d(e,"request","cancel","AnimationFrame"),d(e,"mozRequest","mozCancel","AnimationFrame"),d(e,"webkitRequest","webkitCancel","AnimationFrame")}),Zone.__load_patch("blocking",function(e,t,n){for(var r=["alert","prompt","confirm"],o=0;o<r.length;o++){var a=r[o];h(e,a,function(n,r,o){return function(r,a){return t.current.run(n,e,a,o)}})}}),Zone.__load_patch("EventTarget",function(e,t,n){m(e);var r=e.XMLHttpRequestEventTarget;r&&r.prototype&&u(r.prototype),l("MutationObserver"),l("WebKitMutationObserver"),l("FileReader")}),Zone.__load_patch("on_property",function(e,t,n){b(e),v(),Z(e)}),Zone.__load_patch("XHR",function(e,t,n){function r(e){function n(e){var t=e[o];return t}function r(e){XMLHttpRequest[s]=!1;var t=e.data,n=t.target[i];n&&t.target.removeEventListener("readystatechange",n);var r=t.target[i]=function(){t.target.readyState===t.target.DONE&&!t.aborted&&XMLHttpRequest[s]&&"scheduled"===e.state&&e.invoke()};t.target.addEventListener("readystatechange",r);var a=t.target[o];return a||(t.target[o]=e),p.apply(t.target,t.args),XMLHttpRequest[s]=!0,e}function c(){}function u(e){var t=e.data;return t.aborted=!0,f.apply(t.target,t.args)}var l=h(e.XMLHttpRequest.prototype,"open",function(){return function(e,t){return e[a]=0==t[2],l.apply(e,t)}}),p=h(e.XMLHttpRequest.prototype,"send",function(){return function(e,n){var o=t.current;if(e[a])return p.apply(e,n);var i={target:e,isPeriodic:!1,delay:null,args:n,aborted:!1};return o.scheduleMacroTask("XMLHttpRequest.send",c,i,r,u)}}),f=h(e.XMLHttpRequest.prototype,"abort",function(e){return function(e,t){var r=n(e);if(r&&"string"==typeof r.type){if(null==r.cancelFn||r.data&&r.data.aborted)return;r.zone.cancelTask(r)}}})}r(e);var o=D("xhrTask"),a=D("xhrSync"),i=D("xhrListener"),s=D("xhrScheduled")}),Zone.__load_patch("geolocation",function(e,n,r){e.navigator&&e.navigator.geolocation&&t(e.navigator.geolocation,["getCurrentPosition","watchPosition"])}),Zone.__load_patch("PromiseRejectionEvent",function(e,t,n){function r(t){return function(n){var r=p(e,t);r.forEach(function(r){var o=e.PromiseRejectionEvent;if(o){var a=new o(t,{promise:n.promise,reason:n.rejection});r.invoke(a)}})}}e.PromiseRejectionEvent&&(t[D("unhandledPromiseRejectionHandler")]=r("unhandledrejection"),t[D("rejectionHandledHandler")]=r("rejectionhandled"))})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(this,function(){"use strict";function e(e,t){for(var n=e.length-1;n>=0;n--)"function"==typeof e[n]&&(e[n]=Zone.current.wrap(e[n],t+"_"+n));return e}function t(t,n){for(var r=t.constructor.name,o=function(o){var a=n[o],i=t[a];i&&(t[a]=function(t){var n=function(){return t.apply(this,e(arguments,r+"."+a))};return f(n,t),n}(i))},a=0;a<n.length;a++)o(a)}function n(e,t,n){var r=Object.getOwnPropertyDescriptor(e,t);if(!r&&n){var o=Object.getOwnPropertyDescriptor(n,t);o&&(r={enumerable:!0,configurable:!0})}if(r&&r.configurable){delete r.writable,delete r.value;var a=r.get,i=t.substr(2),s=Z("_"+t);r.set=function(t){var n=this;if(n||e!==z||(n=z),n){var r=n[s];if(r&&n.removeEventListener(i,r),"function"==typeof t){var o=function(e){var n=t.apply(this,arguments);return void 0==n||n||e.preventDefault(),n};n[s]=o,n.addEventListener(i,o,!1)}else n[s]=null}},r.get=function(){var n=this;if(n||e!==z||(n=z),!n)return null;if(n.hasOwnProperty(s))return n[s];if(a){var o=a&&a.apply(this);if(o)return r.set.apply(this,[o]),"function"==typeof n.removeAttribute&&n.removeAttribute(t),o}return null},Object.defineProperty(e,t,r)}}function r(e,t,r){if(t)for(var o=0;o<t.length;o++)n(e,"on"+t[o],r);else{var a=[];for(var i in e)"on"==i.substr(0,2)&&a.push(i);for(var s=0;s<a.length;s++)n(e,a[s],r)}}function o(e,t){var n="boolean"==typeof e?e:"object"==typeof e&&(e&&e.capture),r="boolean"==typeof t?t:"object"==typeof t&&(t&&t.capture);return!!n==!!r}function a(e,t,n,r,a){var i=e[C];if(i)for(var s=0;s<i.length;s++){var c=i[s],u=c.data,l=u.handler;if((u.handler===t||l.listener===t)&&o(u.options,r)&&u.eventName===n)return a&&i.splice(s,1),c}return null}function i(e,t,n){var r=e[C];r||(r=e[C]=[]),n?r.unshift(t):r.push(t)}function s(e,t,n,r,o,s){function c(e){var t=e.data;return i(t.target,e,o),t.invokeAddFunc(l,e)}function u(e){var t=e.data;return a(t.target,e.invoke,t.eventName,t.options,!0),t.invokeRemoveFunc(p,e)}void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===s&&(s=L);var l=Z(e),p=Z(t),h=!n&&void 0;return function(t,n){var o=s(t,n);o.options=o.options||h;var i=null;"function"==typeof o.handler?i=o.handler:o.handler&&o.handler.handleEvent&&(i=function(e){return o.handler.handleEvent(e)});var p=!1;try{p=o.handler&&"[object FunctionWrapper]"===o.handler.toString()}catch(f){return o.crossContext=!0,o.invokeAddFunc(l,o.handler)}if(!i||p)return o.invokeAddFunc(l,o.handler);if(!r){var d=a(o.target,o.handler,o.eventName,o.options,!1);if(d)return o.invokeAddFunc(l,d)}var v=Zone.current,g=o.target.constructor.name+"."+e+":"+o.eventName;v.scheduleEventTask(g,i,o,c,u)}}function c(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=L);var r=Z(e),o=!t&&void 0;return function(e,t){var i=n(e,t);i.options=i.options||o;var s=null;"function"==typeof i.handler?s=i.handler:i.handler&&i.handler.handleEvent&&(s=function(e){return i.handler.handleEvent(e)});var c=!1;try{c=i.handler&&"[object FunctionWrapper]"===i.handler.toString()}catch(u){return i.crossContext=!0,i.invokeRemoveFunc(r,i.handler)}if(!s||c)return i.invokeRemoveFunc(r,i.handler);var l=a(i.target,i.handler,i.eventName,i.options,!0);l?l.zone.cancelTask(l):i.invokeRemoveFunc(r,i.handler)}}function u(e,t,n,r){return void 0===t&&(t=M),void 0===n&&(n=I),void 0===r&&(r=L),!(!e||!e[t])&&(p(e,t,function(){return s(t,n,!0,!1,!1,r)}),p(e,n,function(){return c(n,!0,r)}),!0)}function l(t){var n=z[t];if(n){z[Z(t)]=n,z[t]=function(){var r=e(arguments,t);switch(r.length){case 0:this[F]=new n;break;case 1:this[F]=new n(r[0]);break;case 2:this[F]=new n(r[0],r[1]);break;case 3:this[F]=new n(r[0],r[1],r[2]);break;case 4:this[F]=new n(r[0],r[1],r[2],r[3]);break;default:throw new Error("Arg list too long.")}},f(z[t],n);var r,o=new n(function(){});for(r in o)"XMLHttpRequest"===t&&"responseBlob"===r||!function(e){"function"==typeof o[e]?z[t].prototype[e]=function(){return this[F][e].apply(this[F],arguments)}:Object.defineProperty(z[t].prototype,e,{set:function(n){"function"==typeof n?(this[F][e]=Zone.current.wrap(n,t+"."+e),f(this[F][e],n)):this[F][e]=n},get:function(){return this[F][e]}})}(r);for(r in n)"prototype"!==r&&n.hasOwnProperty(r)&&(z[t][r]=n[r])}}function p(e,t,n){for(var r=e;r&&!r.hasOwnProperty(t);)r=Object.getPrototypeOf(r);!r&&e[t]&&(r=e);var o,a=Z(t);if(r&&!(o=r[a])){o=r[a]=r[t];var i=n(o,a,t);r[t]=function(){return i(this,arguments)},f(r[t],o)}return o}function h(e,t){var n=e[Z("eventTasks")],r=[];if(n)for(var o=0;o<n.length;o++){var a=n[o],i=a.data,s=i&&i.eventName;s===t&&r.push(a)}return r}function f(e,t){e[Z("OriginalDelegate")]=t}function d(e,t,n,r){function o(t){function n(){try{t.invoke.apply(this,arguments)}finally{"number"==typeof r.handleId&&delete c[r.handleId]}}var r=t.data;return r.args[0]=n,r.handleId=i.apply(e,r.args),"number"==typeof r.handleId&&(c[r.handleId]=t),t}function a(e){return"number"==typeof e.data.handleId&&delete c[e.data.handleId],s(e.data.handleId)}var i=null,s=null;t+=r,n+=r;var c={};i=p(e,t,function(n){return function(i,s){if("function"==typeof s[0]){var c=Zone.current,u={handleId:null,isPeriodic:"Interval"===r,delay:"Timeout"===r||"Interval"===r?s[1]||0:null,args:s},l=c.scheduleMacroTask(t,s[0],u,o,a);if(!l)return l;var p=l.data.handleId;return p&&p.ref&&p.unref&&"function"==typeof p.ref&&"function"==typeof p.unref&&(l.ref=p.ref.bind(p),l.unref=p.unref.bind(p)),l}return n.apply(e,s)}}),s=p(e,n,function(t){return function(n,r){var o="number"==typeof r[0]?c[r[0]]:r[0];o&&"string"==typeof o.type?"notScheduled"!==o.state&&(o.cancelFn&&o.data.isPeriodic||0===o.runCount)&&o.zone.cancelTask(o):t.apply(e,r)}})}function v(){Object.defineProperty=function(e,t,n){if(y(e,t))throw new TypeError("Cannot assign to read only property '"+t+"' of "+e);var r=n.configurable;return"prototype"!==t&&(n=k(e,t,n)),m(e,t,n,r)},Object.defineProperties=function(e,t){return Object.keys(t).forEach(function(n){Object.defineProperty(e,n,t[n])}),e},Object.create=function(e,t){return"object"!=typeof t||Object.isFrozen(t)||Object.keys(t).forEach(function(n){t[n]=k(e,n,t[n])}),x(e,t)},Object.getOwnPropertyDescriptor=function(e,t){var n=R(e,t);return y(e,t)&&(n.configurable=!1),n}}function g(e,t,n){var r=n.configurable;return n=k(e,t,n),m(e,t,n,r)}function y(e,t){return e&&e[q]&&e[q][t]}function k(e,t,n){return n.configurable=!0,n.configurable||(e[q]||H(e,q,{writable:!0,value:{}}),e[q][t]=!0),n}function m(e,t,n,r){try{return H(e,t,n)}catch(o){if(!n.configurable)throw o;"undefined"==typeof r?delete n.configurable:n.configurable=r;try{return H(e,t,n)}catch(o){var a=null;try{a=JSON.stringify(n)}catch(o){a=a.toString()}console.log("Attempting to configure '"+t+"' with descriptor '"+a+"' on object '"+e+"' and got error, giving up: "+o)}}}function _(e){var t=[],n=e.wtf;n?t=A.split(",").map(function(e){return"HTML"+e+"Element"}).concat(B):e[X]?t.push(X):t=B;for(var r=0;r<t.length;r++){var o=e[t[r]];u(o&&o.prototype)}}function b(e){var t=e.WebSocket;e.EventTarget||u(t.prototype),e.WebSocket=function(e,n){var o,a=arguments.length>1?new t(e,n):new t(e),i=Object.getOwnPropertyDescriptor(a,"onmessage");return i&&i.configurable===!1?(o=Object.create(a),["addEventListener","removeEventListener","send","close"].forEach(function(e){o[e]=function(){return a[e].apply(a,arguments)}})):o=a,r(o,["close","error","message","open"]),o};for(var n in t)e.WebSocket[n]=t[n]}function T(e){if(!O||j){var t="undefined"!=typeof WebSocket;if(w()){if(P){r(window,ae,Object.getPrototypeOf(window)),r(Document.prototype,ae),"undefined"!=typeof window.SVGElement&&r(window.SVGElement.prototype,ae),r(Element.prototype,ae),r(HTMLElement.prototype,ae),r(HTMLMediaElement.prototype,V),r(HTMLFrameSetElement.prototype,U.concat(ee)),r(HTMLBodyElement.prototype,U.concat(ee)),r(HTMLFrameElement.prototype,$),r(HTMLIFrameElement.prototype,$);var n=window.HTMLMarqueeElement;n&&r(n.prototype,te)}r(XMLHttpRequest.prototype,ne);var o=e.XMLHttpRequestEventTarget;o&&r(o&&o.prototype,ne),"undefined"!=typeof IDBIndex&&(r(IDBIndex.prototype,re),r(IDBRequest.prototype,re),r(IDBOpenDBRequest.prototype,re),r(IDBDatabase.prototype,re),r(IDBTransaction.prototype,re),r(IDBCursor.prototype,re)),t&&r(WebSocket.prototype,oe)}else E(),l("XMLHttpRequest"),t&&b(e)}}function w(){if((P||j)&&!Object.getOwnPropertyDescriptor(HTMLElement.prototype,"onclick")&&"undefined"!=typeof Element){var e=Object.getOwnPropertyDescriptor(Element.prototype,"onclick");if(e&&!e.configurable)return!1}var t=Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype,"onreadystatechange");if(t){Object.defineProperty(XMLHttpRequest.prototype,"onreadystatechange",{enumerable:!0,configurable:!0,get:function(){return!0}});var n=new XMLHttpRequest,r=!!n.onreadystatechange;return Object.defineProperty(XMLHttpRequest.prototype,"onreadystatechange",t||{}),r}Object.defineProperty(XMLHttpRequest.prototype,"onreadystatechange",{enumerable:!0,configurable:!0,get:function(){return this[Z("fakeonreadystatechange")]},set:function(e){this[Z("fakeonreadystatechange")]=e}});var n=new XMLHttpRequest,o=function(){};n.onreadystatechange=o;var r=n[Z("fakeonreadystatechange")]===o;return n.onreadystatechange=null,r}function E(){for(var e=function(e){var t=ae[e],n="on"+t;self.addEventListener(t,function(e){var t,r,o=e.target;for(r=o?o.constructor.name+"."+n:"unknown."+n;o;)o[n]&&!o[n][ie]&&(t=Zone.current.wrap(o[n],r),t[ie]=o[n],o[n]=t),o=o.parentElement},!0)},t=0;t<ae.length;t++)e(t)}function D(e){if((P||j)&&"registerElement"in e.document){var t=document.registerElement,n=["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"];document.registerElement=function(e,r){return r&&r.prototype&&n.forEach(function(e){var t="Document.registerElement::"+e;if(r.prototype.hasOwnProperty(e)){var n=Object.getOwnPropertyDescriptor(r.prototype,e);n&&n.value?(n.value=Zone.current.wrap(n.value,t),g(r.prototype,e,n)):r.prototype[e]=Zone.current.wrap(r.prototype[e],t)}else r.prototype[e]&&(r.prototype[e]=Zone.current.wrap(r.prototype[e],t))}),t.apply(document,[e,r])},f(document.registerElement,t)}}(function(e){function t(e){s&&s.mark&&s.mark(e)}function n(e,t){s&&s.measure&&s.measure(e,t)}function r(t){0===j&&0===v.length&&(e[f]?e[f].resolve(0)[d](o):e[h](o,0)),t&&v.push(t)}function o(){if(!g){for(g=!0;v.length;){var e=v;v=[];for(var t=0;t<e.length;t++){var n=e[t];try{n.zone.runTask(n,null,null)}catch(r){S.onUnhandledError(r)}}}!c[i("ignoreConsoleErrorUncaughtError")];S.microtaskDrainDone(),g=!1}}function a(){}function i(e){return"__zone_symbol__"+e}var s=e.performance;if(t("Zone"),e.Zone)throw new Error("Zone already loaded.");var c=function(){function r(e,t){this._properties=null,this._parent=e,this._name=t?t.name||"unnamed":"<root>",this._properties=t&&t.properties||{},this._zoneDelegate=new l(this,this._parent&&this._parent._zoneDelegate,t)}return r.assertZonePatched=function(){if(e.Promise!==z.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")},Object.defineProperty(r,"root",{get:function(){for(var e=r.current;e.parent;)e=e.parent;return e},enumerable:!0,configurable:!0}),Object.defineProperty(r,"current",{get:function(){return O.zone},enumerable:!0,configurable:!0}),Object.defineProperty(r,"currentTask",{get:function(){return P},enumerable:!0,configurable:!0}),r.__load_patch=function(o,a){if(z.hasOwnProperty(o))throw Error("Already loaded patch: "+o);if(!e["__Zone_disable_"+o]){var i="Zone:"+o;t(i),z[o]=a(e,r,S),n(i,i)}},Object.defineProperty(r.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),r.prototype.get=function(e){var t=this.getZoneWith(e);if(t)return t._properties[e]},r.prototype.getZoneWith=function(e){for(var t=this;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null},r.prototype.fork=function(e){if(!e)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)},r.prototype.wrap=function(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);var n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}},r.prototype.run=function(e,t,n,r){void 0===t&&(t=void 0),void 0===n&&(n=null),void 0===r&&(r=null),O={parent:O,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{O=O.parent}},r.prototype.runGuarded=function(e,t,n,r){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null),O={parent:O,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(o){if(this._zoneDelegate.handleError(this,o))throw o}}finally{O=O.parent}},r.prototype.runTask=function(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(e.zone||y).name+"; Execution: "+this.name+")");var r=e.state===k;if(!r||e.type!==Z){var o=e.state!=b;o&&e._transitionTo(b,_),e.runCount++;var a=P;P=e,O={parent:O,zone:this};try{e.type==D&&e.data&&!e.data.isPeriodic&&(e.cancelFn=null);try{return this._zoneDelegate.invokeTask(this,e,t,n)}catch(i){if(this._zoneDelegate.handleError(this,i))throw i}}finally{e.state!==k&&e.state!==w&&(e.type==Z||e.data&&e.data.isPeriodic?o&&e._transitionTo(_,b):(e.runCount=0,this._updateTaskCount(e,-1),o&&e._transitionTo(k,b,k))),O=O.parent,P=a}}},r.prototype.scheduleTask=function(e){if(e.zone&&e.zone!==this)for(var t=this;t;){if(t===e.zone)throw Error("can not reschedule task to "+this.name+" which is descendants of the original zone "+e.zone.name);t=t.parent}e._transitionTo(m,k);var n=[];e._zoneDelegates=n,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(r){throw e._transitionTo(w,m,k),this._zoneDelegate.handleError(this,r),r}return e._zoneDelegates===n&&this._updateTaskCount(e,1),e.state==m&&e._transitionTo(_,m),e},r.prototype.scheduleMicroTask=function(e,t,n,r){return this.scheduleTask(new p(E,e,t,n,r,null))},r.prototype.scheduleMacroTask=function(e,t,n,r,o){return this.scheduleTask(new p(D,e,t,n,r,o))},r.prototype.scheduleEventTask=function(e,t,n,r,o){return this.scheduleTask(new p(Z,e,t,n,r,o))},r.prototype.cancelTask=function(e){if(e.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(e.zone||y).name+"; Execution: "+this.name+")");e._transitionTo(T,_,b);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(w,T),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(k,T),e.runCount=0,e},r.prototype._updateTaskCount=function(e,t){var n=e._zoneDelegates;t==-1&&(e._zoneDelegates=null);for(var r=0;r<n.length;r++)n[r]._updateTaskCount(e.type,t)},r}();c.__symbol__=i;var u={name:"",onHasTask:function(e,t,n,r){return e.hasTask(n,r)},onScheduleTask:function(e,t,n,r){return e.scheduleTask(n,r)},onInvokeTask:function(e,t,n,r,o,a){return e.invokeTask(n,r,o,a)},onCancelTask:function(e,t,n,r){return e.cancelTask(n,r)}},l=function(){function e(e,t,n){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this.zone=e,this._parentDelegate=t,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._forkCurrZone=n&&(n.onFork?this.zone:t.zone),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._interceptCurrZone=n&&(n.onIntercept?this.zone:t.zone),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._invokeCurrZone=n&&(n.onInvoke?this.zone:t.zone),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._handleErrorCurrZone=n&&(n.onHandleError?this.zone:t.zone),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._scheduleTaskCurrZone=n&&(n.onScheduleTask?this.zone:t.zone),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._invokeTaskCurrZone=n&&(n.onInvokeTask?this.zone:t.zone),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._cancelTaskCurrZone=n&&(n.onCancelTask?this.zone:t.zone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;var r=n&&n.onHasTask,o=t&&t._hasTaskZS;(r||o)&&(this._hasTaskZS=r?n:u,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=e,n.onScheduleTask||(this._scheduleTaskZS=u,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this.zone),n.onInvokeTask||(this._invokeTaskZS=u,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this.zone),n.onCancelTask||(this._cancelTaskZS=u,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this.zone))}return e.prototype.fork=function(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new c(e,t)},e.prototype.intercept=function(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,e,t,n):t},e.prototype.invoke=function(e,t,n,r,o){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,r,o):t.apply(n,r)},e.prototype.handleError=function(e,t){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t)},e.prototype.scheduleTask=function(e,t){var n=t;if(this._scheduleTaskZS)this._hasTaskZS&&n._zoneDelegates.push(this._hasTaskDlgtOwner),n=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,e,t),n||(n=t);else if(t.scheduleFn)t.scheduleFn(t);else{if(t.type!=E)throw new Error("Task is missing scheduleFn.");r(t)}return n},e.prototype.invokeTask=function(e,t,n,r){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,e,t,n,r):t.callback.apply(n,r)},e.prototype.cancelTask=function(e,t){var n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,e,t);else{if(!t.cancelFn)throw Error("Task is not cancelable");n=t.cancelFn(t)}return n},e.prototype.hasTask=function(e,t){try{return this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,e,t)}catch(n){this.handleError(e,n)}},e.prototype._updateTaskCount=function(e,t){var n=this._taskCounts,r=n[e],o=n[e]=r+t;if(o<0)throw new Error("More tasks executed then were scheduled.");if(0==r||0==o){var a={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};this.hasTask(this.zone,a)}},e}(),p=function(){function e(e,t,n,r,a,i){this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=e,this.source=t,this.data=r,this.scheduleFn=a,this.cancelFn=i,this.callback=n;var s=this;this.invoke=function(){j++;try{return s.runCount++,s.zone.runTask(s,this,arguments)}finally{1==j&&o(),j--}}}return Object.defineProperty(e.prototype,"zone",{get:function(){return this._zone},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),e.prototype.cancelScheduleRequest=function(){this._transitionTo(k,m)},e.prototype._transitionTo=function(e,t,n){if(this._state!==t&&this._state!==n)throw new Error(this.type+" '"+this.source+"': can not transition to '"+e+"', expecting state '"+t+"'"+(n?" or '"+n+"'":"")+", was '"+this._state+"'.");this._state=e,e==k&&(this._zoneDelegates=null)},e.prototype.toString=function(){return this.data&&"undefined"!=typeof this.data.handleId?this.data.handleId:Object.prototype.toString.call(this)},e.prototype.toJSON=function(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,invoke:this.invoke,scheduleFn:this.scheduleFn,cancelFn:this.cancelFn,runCount:this.runCount,callback:this.callback}},e}(),h=i("setTimeout"),f=i("Promise"),d=i("then"),v=[],g=!1,y={name:"NO ZONE"},k="notScheduled",m="scheduling",_="scheduled",b="running",T="canceling",w="unknown",E="microTask",D="macroTask",Z="eventTask",z={},S={symbol:i,currentZoneFrame:function(){return O},onUnhandledError:a,microtaskDrainDone:a,scheduleMicroTask:r,showUncaughtError:function(){return!c[i("ignoreConsoleErrorUncaughtError")]},patchEventTargetMethods:function(){return!1},patchOnProperties:a},O={parent:null,zone:new c(null,null)},P=null,j=0;return n("Zone","Zone"),e.Zone=c})("undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global);Zone.__load_patch("ZoneAwarePromise",function(e,t,n){function r(e){n.onUnhandledError(e);try{var r=t[f("unhandledPromiseRejectionHandler")];r&&"function"==typeof r&&r.apply(this,[e])}catch(o){}}function o(e){return e&&e.then}function a(e){return e}function i(e){return D.reject(e)}function s(e,t){return function(n){try{c(e,t,n)}catch(r){c(e,!1,r)}}}function c(e,r,o){var a=E();if(e===o)throw new TypeError("Promise resolved with itself");if(e[y]===_){var i=null;try{"object"!=typeof o&&"function"!=typeof o||(i=o&&o.then)}catch(p){return a(function(){c(e,!1,p)})(),e}if(r!==T&&o instanceof D&&o.hasOwnProperty(y)&&o.hasOwnProperty(k)&&o[y]!==_)u(o),c(e,o[y],o[k]);else if(r!==T&&"function"==typeof i)try{i.apply(o,[a(s(e,r)),a(s(e,!1))])}catch(p){a(function(){c(e,!1,p)})()}else{e[y]=r;var h=e[k];e[k]=o,r===T&&o instanceof Error&&(o[f("currentTask")]=t.currentTask);for(var v=0;v<h.length;)l(e,h[v++],h[v++],h[v++],h[v++]);if(0==h.length&&r==T){e[y]=w;try{throw new Error("Uncaught (in promise): "+o+(o&&o.stack?"\n"+o.stack:""))}catch(p){var g=p;g.rejection=o,g.promise=e,g.zone=t.current,g.task=t.currentTask,d.push(g),n.scheduleMicroTask()}}}}return e}function u(e){if(e[y]===w){try{var n=t[f("rejectionHandledHandler")];n&&"function"==typeof n&&n.apply(this,[{rejection:e[k],promise:e}])}catch(r){}e[y]=T;for(var o=0;o<d.length;o++)e===d[o].promise&&d.splice(o,1)}}function l(e,t,n,r,o){u(e);var s=e[y]?"function"==typeof r?r:a:"function"==typeof o?o:i;t.scheduleMicroTask(m,function(){try{c(n,!0,t.run(s,void 0,[e[k]]))}catch(r){c(n,!1,r)}})}function p(e){var t=e.prototype,n=t.then;t[g]=n,e.prototype.then=function(e,t){var r=this,o=new D(function(e,t){n.call(r,e,t)});return o.then(e,t)},e[z]=!0}function h(e){return function(){var t=e.apply(this,arguments);if(t instanceof D)return t;var n=t.constructor;return n[z]||p(n),t}}var f=n.symbol,d=[],v=f("Promise"),g=f("then");n.onUnhandledError=function(e){if(n.showUncaughtError()){var t=e&&e.rejection;t&&console.error("Unhandled Promise rejection:",t instanceof Error?t.message:t,"; Zone:",e.zone.name,"; Task:",e.task&&e.task.source,"; Value:",t,t instanceof Error?t.stack:void 0),console.error(e)}},n.microtaskDrainDone=function(){for(;d.length;)for(var e=function(){var e=d.shift();try{e.zone.runGuarded(function(){throw e})}catch(t){r(t)}};d.length;)e()};var y=f("state"),k=f("value"),m="Promise.then",_=null,b=!0,T=!1,w=0,E=function(){var e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},D=function(){function e(t){var n=this;if(!(n instanceof e))throw new Error("Must be an instanceof Promise.");n[y]=_,n[k]=[];try{t&&t(s(n,b),s(n,T))}catch(r){c(n,!1,r)}}return e.toString=function(){return"function ZoneAwarePromise() { [native code] }"},e.resolve=function(e){return c(new this(null),b,e)},e.reject=function(e){return c(new this(null),T,e)},e.race=function(e){function t(e){i&&(i=r(e))}function n(e){i&&(i=a(e))}for(var r,a,i=new this(function(e,t){n=[e,t],r=n[0],a=n[1];var n}),s=0,c=e;s<c.length;s++){var u=c[s];o(u)||(u=this.resolve(u)),u.then(t,n)}return i},e.all=function(e){for(var t,n,r=new this(function(e,r){t=e,n=r}),a=0,i=[],s=0,c=e;s<c.length;s++){var u=c[s];o(u)||(u=this.resolve(u)),u.then(function(e){return function(n){i[e]=n,a--,a||t(i)}}(a),n),a++}return a||t(i),r},e.prototype.then=function(e,n){var r=new this.constructor(null),o=t.current;return this[y]==_?this[k].push(o,r,e,n):l(this,o,r,e,n),r},e.prototype["catch"]=function(e){return this.then(null,e)},e}();D.resolve=D.resolve,D.reject=D.reject,D.race=D.race,D.all=D.all;var Z=e[v]=e.Promise;e.Promise=D;var z=f("thenPatched");if(Z){p(Z);var S=e.fetch;"function"==typeof S&&(e.fetch=h(S))}return Promise[t.__symbol__("uncaughtPromiseErrors")]=d,D});var Z=function(e){return"__zone_symbol__"+e},z="object"==typeof window&&window||"object"==typeof self&&self||global,S="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,O=!("nw"in z)&&"undefined"!=typeof z.process&&"[object process]"==={}.toString.call(z.process),P=!O&&!S&&!("undefined"==typeof window||!window.HTMLElement),j="undefined"!=typeof z.process&&"[object process]"==={}.toString.call(z.process)&&!S&&!("undefined"==typeof window||!window.HTMLElement),C=Z("eventTasks"),M="addEventListener",I="removeEventListener",L=function(e,t){return{options:t[2],eventName:t[0],handler:t[1],target:e||z,name:t[0],crossContext:!1,invokeAddFunc:function(e,t){if(!this.crossContext)return t&&t.invoke?this.target[e](this.eventName,t.invoke,this.options):this.target[e](this.eventName,t,this.options);try{return this.target[e](this.eventName,t,this.options)}catch(n){}},invokeRemoveFunc:function(e,t){if(!this.crossContext)return t&&t.invoke?this.target[e](this.eventName,t.invoke,this.options):this.target[e](this.eventName,t,this.options);try{return this.target[e](this.eventName,t,this.options)}catch(n){}}}},F=Z("originalInstance");Zone.__load_patch("toString",function(e,t,n){var r=Function.prototype.toString;Function.prototype.toString=function(){if("function"==typeof this){if(this[Z("OriginalDelegate")])return r.apply(this[Z("OriginalDelegate")],arguments);if(this===Promise){var t=e[Z("Promise")];if(t)return r.apply(t,arguments)}if(this===Error){var n=e[Z("Error")];if(n)return r.apply(n,arguments)}}return r.apply(this,arguments)};var o=Object.prototype.toString;Object.prototype.toString=function(){return this instanceof Promise?"[object Promise]":o.apply(this,arguments)}});var H=Object[Z("defineProperty")]=Object.defineProperty,R=Object[Z("getOwnPropertyDescriptor")]=Object.getOwnPropertyDescriptor,x=Object.create,q=Z("unconfigurables"),A="Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video",B="ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Window,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex,WebSocket".split(","),X="EventTarget",N=["abort","animationcancel","animationend","animationiteration","auxclick","beforeinput","blur","cancel","canplay","canplaythrough","change","compositionstart","compositionupdate","compositionend","cuechange","click","close","contextmenu","curechange","dblclick","drag","dragend","dragenter","dragexit","dragleave","dragover","drop","durationchange","emptied","ended","error","focus","focusin","focusout","gotpointercapture","input","invalid","keydown","keypress","keyup","load","loadstart","loadeddata","loadedmetadata","lostpointercapture","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","pointercancel","pointerdown","pointerenter","pointerleave","pointerlockchange","mozpointerlockchange","webkitpointerlockerchange","pointerlockerror","mozpointerlockerror","webkitpointerlockerror","pointermove","pointout","pointerover","pointerup","progress","ratechange","reset","resize","scroll","seeked","seeking","select","selectionchange","selectstart","show","sort","stalled","submit","suspend","timeupdate","volumechange","touchcancel","touchmove","touchstart","transitioncancel","transitionend","waiting","wheel"],W=["afterscriptexecute","beforescriptexecute","DOMContentLoaded","fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange","fullscreenerror","mozfullscreenerror","webkitfullscreenerror","msfullscreenerror","readystatechange"],U=["absolutedeviceorientation","afterinput","afterprint","appinstalled","beforeinstallprompt","beforeprint","beforeunload","devicelight","devicemotion","deviceorientation","deviceorientationabsolute","deviceproximity","hashchange","languagechange","message","mozbeforepaint","offline","online","paint","pageshow","pagehide","popstate","rejectionhandled","storage","unhandledrejection","unload","userproximity","vrdisplyconnected","vrdisplaydisconnected","vrdisplaypresentchange"],G=["beforecopy","beforecut","beforepaste","copy","cut","paste","dragstart","loadend","animationstart","search","transitionrun","transitionstart","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend"],V=["encrypted","waitingforkey","msneedkey","mozinterruptbegin","mozinterruptend"],K=["activate","afterupdate","ariarequest","beforeactivate","beforedeactivate","beforeeditfocus","beforeupdate","cellchange","controlselect","dataavailable","datasetchanged","datasetcomplete","errorupdate","filterchange","layoutcomplete","losecapture","move","moveend","movestart","propertychange","resizeend","resizestart","rowenter","rowexit","rowsdelete","rowsinserted","command","compassneedscalibration","deactivate","help","mscontentzoom","msmanipulationstatechanged","msgesturechange","msgesturedoubletap","msgestureend","msgesturehold","msgesturestart","msgesturetap","msgotpointercapture","msinertiastart","mslostpointercapture","mspointercancel","mspointerdown","mspointerenter","mspointerhover","mspointerleave","mspointermove","mspointerout","mspointerover","mspointerup","pointerout","mssitemodejumplistitemremoved","msthumbnailclick","stop","storagecommit"],J=["webglcontextrestored","webglcontextlost","webglcontextcreationerror"],Q=["autocomplete","autocompleteerror"],Y=["toggle"],$=["load"],ee=["blur","error","focus","load","resize","scroll"],te=["bounce","finish","start"],ne=["loadstart","progress","abort","error","load","progress","timeout","loadend","readystatechange"],re=["upgradeneeded","complete","abort","success","error","blocked","versionchange","close"],oe=["close","error","open","message"],ae=N.concat(J,Q,Y,W,U,G,K),ie=Z("unbound");Zone.__load_patch("timers",function(e,t,n){var r="set",o="clear";d(e,r,o,"Timeout"),d(e,r,o,"Interval"),d(e,r,o,"Immediate"),d(e,"request","cancel","AnimationFrame"),d(e,"mozRequest","mozCancel","AnimationFrame"),d(e,"webkitRequest","webkitCancel","AnimationFrame")}),Zone.__load_patch("blocking",function(e,t,n){for(var r=["alert","prompt","confirm"],o=0;o<r.length;o++){var a=r[o];p(e,a,function(n,r,o){return function(r,a){return t.current.run(n,e,a,o)}})}}),Zone.__load_patch("EventTarget",function(e,t,n){_(e);var r=e.XMLHttpRequestEventTarget;r&&r.prototype&&u(r.prototype),l("MutationObserver"),l("WebKitMutationObserver"),l("FileReader")}),Zone.__load_patch("on_property",function(e,t,n){T(e),v(),D(e)}),Zone.__load_patch("XHR",function(e,t,n){function r(e){function n(e){var t=e[o];return t}function r(e){XMLHttpRequest[s]=!1;var t=e.data,n=t.target[i];n&&t.target.removeEventListener("readystatechange",n);var r=t.target[i]=function(){t.target.readyState===t.target.DONE&&!t.aborted&&XMLHttpRequest[s]&&"scheduled"===e.state&&e.invoke()};t.target.addEventListener("readystatechange",r);var a=t.target[o];return a||(t.target[o]=e),h.apply(t.target,t.args),XMLHttpRequest[s]=!0,e}function c(){}function u(e){ | ||
var t=e.data;return t.aborted=!0,f.apply(t.target,t.args)}var l=p(e.XMLHttpRequest.prototype,"open",function(){return function(e,t){return e[a]=0==t[2],l.apply(e,t)}}),h=p(e.XMLHttpRequest.prototype,"send",function(){return function(e,n){var o=t.current;if(e[a])return h.apply(e,n);var i={target:e,isPeriodic:!1,delay:null,args:n,aborted:!1};return o.scheduleMacroTask("XMLHttpRequest.send",c,i,r,u)}}),f=p(e.XMLHttpRequest.prototype,"abort",function(e){return function(e,t){var r=n(e);if(r&&"string"==typeof r.type){if(null==r.cancelFn||r.data&&r.data.aborted)return;r.zone.cancelTask(r)}}})}r(e);var o=Z("xhrTask"),a=Z("xhrSync"),i=Z("xhrListener"),s=Z("xhrScheduled")}),Zone.__load_patch("geolocation",function(e,n,r){e.navigator&&e.navigator.geolocation&&t(e.navigator.geolocation,["getCurrentPosition","watchPosition"])}),Zone.__load_patch("PromiseRejectionEvent",function(e,t,n){function r(t){return function(n){var r=h(e,t);r.forEach(function(r){var o=e.PromiseRejectionEvent;if(o){var a=new o(t,{promise:n.promise,reason:n.rejection});r.invoke(a)}})}}e.PromiseRejectionEvent&&(t[Z("unhandledPromiseRejectionHandler")]=r("unhandledrejection"),t[Z("rejectionHandledHandler")]=r("rejectionhandled"))}),Zone.__load_patch("util",function(e,t,n){n.patchEventTargetMethods=u,n.patchOnProperties=r})}); |
@@ -9,6 +9,4 @@ /** | ||
import '../common/to-string'; | ||
import {patchTimer} from '../common/timers'; | ||
import {findEventTask, patchClass, patchEventTargetMethods, patchMethod, patchPrototype, zoneSymbol} from '../common/utils'; | ||
import {findEventTask, patchClass, patchEventTargetMethods, patchMethod, patchOnProperties, patchPrototype, zoneSymbol} from '../common/utils'; | ||
@@ -194,1 +192,7 @@ import {propertyPatch} from './define-property'; | ||
}); | ||
Zone.__load_patch('util', (global: any, Zone: ZoneType, api: _ZonePrivate) => { | ||
api.patchEventTargetMethods = patchEventTargetMethods; | ||
api.patchOnProperties = patchOnProperties; | ||
}); |
@@ -13,6 +13,218 @@ /** | ||
const eventNames = | ||
'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror' | ||
.split(' '); | ||
const globalEventHandlersEventNames = [ | ||
'abort', | ||
'animationcancel', | ||
'animationend', | ||
'animationiteration', | ||
'auxclick', | ||
'beforeinput', | ||
'blur', | ||
'cancel', | ||
'canplay', | ||
'canplaythrough', | ||
'change', | ||
'compositionstart', | ||
'compositionupdate', | ||
'compositionend', | ||
'cuechange', | ||
'click', | ||
'close', | ||
'contextmenu', | ||
'curechange', | ||
'dblclick', | ||
'drag', | ||
'dragend', | ||
'dragenter', | ||
'dragexit', | ||
'dragleave', | ||
'dragover', | ||
'drop', | ||
'durationchange', | ||
'emptied', | ||
'ended', | ||
'error', | ||
'focus', | ||
'focusin', | ||
'focusout', | ||
'gotpointercapture', | ||
'input', | ||
'invalid', | ||
'keydown', | ||
'keypress', | ||
'keyup', | ||
'load', | ||
'loadstart', | ||
'loadeddata', | ||
'loadedmetadata', | ||
'lostpointercapture', | ||
'mousedown', | ||
'mouseenter', | ||
'mouseleave', | ||
'mousemove', | ||
'mouseout', | ||
'mouseover', | ||
'mouseup', | ||
'mousewheel', | ||
'pause', | ||
'play', | ||
'playing', | ||
'pointercancel', | ||
'pointerdown', | ||
'pointerenter', | ||
'pointerleave', | ||
'pointerlockchange', | ||
'mozpointerlockchange', | ||
'webkitpointerlockerchange', | ||
'pointerlockerror', | ||
'mozpointerlockerror', | ||
'webkitpointerlockerror', | ||
'pointermove', | ||
'pointout', | ||
'pointerover', | ||
'pointerup', | ||
'progress', | ||
'ratechange', | ||
'reset', | ||
'resize', | ||
'scroll', | ||
'seeked', | ||
'seeking', | ||
'select', | ||
'selectionchange', | ||
'selectstart', | ||
'show', | ||
'sort', | ||
'stalled', | ||
'submit', | ||
'suspend', | ||
'timeupdate', | ||
'volumechange', | ||
'touchcancel', | ||
'touchmove', | ||
'touchstart', | ||
'transitioncancel', | ||
'transitionend', | ||
'waiting', | ||
'wheel' | ||
]; | ||
const documentEventNames = [ | ||
'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'fullscreenchange', | ||
'mozfullscreenchange', 'webkitfullscreenchange', 'msfullscreenchange', 'fullscreenerror', | ||
'mozfullscreenerror', 'webkitfullscreenerror', 'msfullscreenerror', 'readystatechange' | ||
]; | ||
const windowEventNames = [ | ||
'absolutedeviceorientation', | ||
'afterinput', | ||
'afterprint', | ||
'appinstalled', | ||
'beforeinstallprompt', | ||
'beforeprint', | ||
'beforeunload', | ||
'devicelight', | ||
'devicemotion', | ||
'deviceorientation', | ||
'deviceorientationabsolute', | ||
'deviceproximity', | ||
'hashchange', | ||
'languagechange', | ||
'message', | ||
'mozbeforepaint', | ||
'offline', | ||
'online', | ||
'paint', | ||
'pageshow', | ||
'pagehide', | ||
'popstate', | ||
'rejectionhandled', | ||
'storage', | ||
'unhandledrejection', | ||
'unload', | ||
'userproximity', | ||
'vrdisplyconnected', | ||
'vrdisplaydisconnected', | ||
'vrdisplaypresentchange' | ||
]; | ||
const htmlElementEventNames = [ | ||
'beforecopy', 'beforecut', 'beforepaste', 'copy', 'cut', 'paste', 'dragstart', 'loadend', | ||
'animationstart', 'search', 'transitionrun', 'transitionstart', 'webkitanimationend', | ||
'webkitanimationiteration', 'webkitanimationstart', 'webkittransitionend' | ||
]; | ||
const mediaElementEventNames = | ||
['encrypted', 'waitingforkey', 'msneedkey', 'mozinterruptbegin', 'mozinterruptend']; | ||
const ieElementEventNames = [ | ||
'activate', | ||
'afterupdate', | ||
'ariarequest', | ||
'beforeactivate', | ||
'beforedeactivate', | ||
'beforeeditfocus', | ||
'beforeupdate', | ||
'cellchange', | ||
'controlselect', | ||
'dataavailable', | ||
'datasetchanged', | ||
'datasetcomplete', | ||
'errorupdate', | ||
'filterchange', | ||
'layoutcomplete', | ||
'losecapture', | ||
'move', | ||
'moveend', | ||
'movestart', | ||
'propertychange', | ||
'resizeend', | ||
'resizestart', | ||
'rowenter', | ||
'rowexit', | ||
'rowsdelete', | ||
'rowsinserted', | ||
'command', | ||
'compassneedscalibration', | ||
'deactivate', | ||
'help', | ||
'mscontentzoom', | ||
'msmanipulationstatechanged', | ||
'msgesturechange', | ||
'msgesturedoubletap', | ||
'msgestureend', | ||
'msgesturehold', | ||
'msgesturestart', | ||
'msgesturetap', | ||
'msgotpointercapture', | ||
'msinertiastart', | ||
'mslostpointercapture', | ||
'mspointercancel', | ||
'mspointerdown', | ||
'mspointerenter', | ||
'mspointerhover', | ||
'mspointerleave', | ||
'mspointermove', | ||
'mspointerout', | ||
'mspointerover', | ||
'mspointerup', | ||
'pointerout', | ||
'mssitemodejumplistitemremoved', | ||
'msthumbnailclick', | ||
'stop', | ||
'storagecommit' | ||
]; | ||
const webglEventNames = ['webglcontextrestored', 'webglcontextlost', 'webglcontextcreationerror']; | ||
const formEventNames = ['autocomplete', 'autocompleteerror']; | ||
const detailEventNames = ['toggle']; | ||
const frameEventNames = ['load']; | ||
const frameSetEventNames = ['blur', 'error', 'focus', 'load', 'resize', 'scroll']; | ||
const marqueeEventNames = ['bounce', 'finish', 'start']; | ||
const XMLHttpRequestEventNames = [ | ||
'loadstart', 'progress', 'abort', 'error', 'load', 'progress', 'timeout', 'loadend', | ||
'readystatechange' | ||
]; | ||
const IDBIndexEventNames = | ||
['upgradeneeded', 'complete', 'abort', 'success', 'error', 'blocked', 'versionchange', 'close']; | ||
const websocketEventNames = ['close', 'error', 'open', 'message']; | ||
const eventNames = globalEventHandlersEventNames.concat( | ||
webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames, | ||
htmlElementEventNames, ieElementEventNames); | ||
export function propertyDescriptorPatch(_global: any) { | ||
@@ -27,20 +239,40 @@ if (isNode && !isMix) { | ||
if (isBrowser) { | ||
patchOnProperties(window, eventNames.concat(['resize'])); | ||
// in IE/Edge, onProp not exist in window object, but in WindowPrototype | ||
// so we need to pass WindowPrototype to check onProp exist or not | ||
patchOnProperties(window, eventNames, Object.getPrototypeOf(window)); | ||
patchOnProperties(Document.prototype, eventNames); | ||
if (typeof(<any>window)['SVGElement'] !== 'undefined') { | ||
patchOnProperties((<any>window)['SVGElement'].prototype, eventNames); | ||
} | ||
patchOnProperties(Element.prototype, eventNames); | ||
patchOnProperties(HTMLElement.prototype, eventNames); | ||
patchOnProperties(HTMLMediaElement.prototype, mediaElementEventNames); | ||
patchOnProperties(HTMLFrameSetElement.prototype, windowEventNames.concat(frameSetEventNames)); | ||
patchOnProperties(HTMLBodyElement.prototype, windowEventNames.concat(frameSetEventNames)); | ||
patchOnProperties(HTMLFrameElement.prototype, frameEventNames); | ||
patchOnProperties(HTMLIFrameElement.prototype, frameEventNames); | ||
const HTMLMarqueeElement = (window as any)['HTMLMarqueeElement']; | ||
if (HTMLMarqueeElement) { | ||
patchOnProperties(HTMLMarqueeElement.prototype, marqueeEventNames); | ||
} | ||
} | ||
patchOnProperties(XMLHttpRequest.prototype, null); | ||
patchOnProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames); | ||
const XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget']; | ||
if (XMLHttpRequestEventTarget) { | ||
patchOnProperties( | ||
XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, | ||
XMLHttpRequestEventNames); | ||
} | ||
if (typeof IDBIndex !== 'undefined') { | ||
patchOnProperties(IDBIndex.prototype, null); | ||
patchOnProperties(IDBRequest.prototype, null); | ||
patchOnProperties(IDBOpenDBRequest.prototype, null); | ||
patchOnProperties(IDBDatabase.prototype, null); | ||
patchOnProperties(IDBTransaction.prototype, null); | ||
patchOnProperties(IDBCursor.prototype, null); | ||
patchOnProperties(IDBIndex.prototype, IDBIndexEventNames); | ||
patchOnProperties(IDBRequest.prototype, IDBIndexEventNames); | ||
patchOnProperties(IDBOpenDBRequest.prototype, IDBIndexEventNames); | ||
patchOnProperties(IDBDatabase.prototype, IDBIndexEventNames); | ||
patchOnProperties(IDBTransaction.prototype, IDBIndexEventNames); | ||
patchOnProperties(IDBCursor.prototype, IDBIndexEventNames); | ||
} | ||
if (supportsWebSocket) { | ||
patchOnProperties(WebSocket.prototype, null); | ||
patchOnProperties(WebSocket.prototype, websocketEventNames); | ||
} | ||
@@ -47,0 +279,0 @@ } else { |
@@ -9,5 +9,5 @@ /** | ||
import '../zone'; | ||
import '../common/promise'; | ||
import '../common/to-string'; | ||
import './browser'; |
@@ -12,5 +12,3 @@ /** | ||
} | ||
const patchEventTargetMethods = | ||
(Zone as any)[(Zone as any).__symbol__('patchEventTargetMethods')]; | ||
patchEventTargetMethods( | ||
api.patchEventTargetMethods( | ||
_global['MediaQueryList'].prototype, 'addListener', 'removeListener', | ||
@@ -17,0 +15,0 @@ (self: any, args: any[]) => { |
@@ -17,4 +17,3 @@ /** | ||
} | ||
const patchOnProperties = (Zone as any)[(Zone as any).__symbol__('patchOnProperties')]; | ||
patchOnProperties(Notification.prototype, null); | ||
api.patchOnProperties(Notification.prototype, null); | ||
}); |
@@ -50,5 +50,7 @@ /** | ||
// Make sure to access `process` through `_global` so that WebPack does not accidently browserify | ||
// this code. | ||
export const isNode: boolean = | ||
(!('nw' in _global) && typeof process !== 'undefined' && | ||
{}.toString.call(process) === '[object process]'); | ||
(!('nw' in _global) && typeof _global.process !== 'undefined' && | ||
{}.toString.call(_global.process) === '[object process]'); | ||
@@ -59,11 +61,20 @@ export const isBrowser: boolean = | ||
// we are in electron of nw, so we are both browser and nodejs | ||
export const isMix: boolean = typeof process !== 'undefined' && | ||
{}.toString.call(process) === '[object process]' && !isWebWorker && | ||
// Make sure to access `process` through `_global` so that WebPack does not accidently browserify | ||
// this code. | ||
export const isMix: boolean = typeof _global.process !== 'undefined' && | ||
{}.toString.call(_global.process) === '[object process]' && !isWebWorker && | ||
!!(typeof window !== 'undefined' && (window as any)['HTMLElement']); | ||
export function patchProperty(obj: any, prop: string) { | ||
const desc = Object.getOwnPropertyDescriptor(obj, prop) || {enumerable: true, configurable: true}; | ||
// if the descriptor is not configurable | ||
export function patchProperty(obj: any, prop: string, prototype?: any) { | ||
let desc = Object.getOwnPropertyDescriptor(obj, prop); | ||
if (!desc && prototype) { | ||
// when patch window object, use prototype to check prop exist or not | ||
const prototypeDesc = Object.getOwnPropertyDescriptor(prototype, prop); | ||
if (prototypeDesc) { | ||
desc = {enumerable: true, configurable: true}; | ||
} | ||
} | ||
// if the descriptor not exists or is not configurable | ||
// just return | ||
if (!desc.configurable) { | ||
if (!desc || !desc.configurable) { | ||
return; | ||
@@ -153,6 +164,6 @@ } | ||
export function patchOnProperties(obj: any, properties: string[]) { | ||
export function patchOnProperties(obj: any, properties: string[], prototype?: any) { | ||
if (properties) { | ||
for (let i = 0; i < properties.length; i++) { | ||
patchProperty(obj, 'on' + properties[i]); | ||
patchProperty(obj, 'on' + properties[i], prototype); | ||
} | ||
@@ -167,3 +178,3 @@ } else { | ||
for (let j = 0; j < onProperties.length; j++) { | ||
patchProperty(obj, onProperties[j]); | ||
patchProperty(obj, onProperties[j], prototype); | ||
} | ||
@@ -671,4 +682,1 @@ } | ||
} | ||
(Zone as any)[zoneSymbol('patchEventTargetMethods')] = patchEventTargetMethods; | ||
(Zone as any)[zoneSymbol('patchOnProperties')] = patchOnProperties; |
@@ -9,5 +9,6 @@ /** | ||
import '../zone'; | ||
import '../common/promise'; | ||
import '../common/to-string'; | ||
import '../browser/browser'; | ||
import '../node/node'; |
@@ -11,50 +11,52 @@ /** | ||
const callAndReturnFirstParam = (fn: (self: any, args: any[]) => any) => { | ||
return (self: any, args: any[]) => { | ||
fn(self, args); | ||
return self; | ||
Zone.__load_patch('EventEmitter', (global: any, Zone: ZoneType, api: _ZonePrivate) => { | ||
const callAndReturnFirstParam = (fn: (self: any, args: any[]) => any) => { | ||
return (self: any, args: any[]) => { | ||
fn(self, args); | ||
return self; | ||
}; | ||
}; | ||
}; | ||
// For EventEmitter | ||
const EE_ADD_LISTENER = 'addListener'; | ||
const EE_PREPEND_LISTENER = 'prependListener'; | ||
const EE_REMOVE_LISTENER = 'removeListener'; | ||
const EE_REMOVE_ALL_LISTENER = 'removeAllListeners'; | ||
const EE_LISTENERS = 'listeners'; | ||
const EE_ON = 'on'; | ||
// For EventEmitter | ||
const EE_ADD_LISTENER = 'addListener'; | ||
const EE_PREPEND_LISTENER = 'prependListener'; | ||
const EE_REMOVE_LISTENER = 'removeListener'; | ||
const EE_REMOVE_ALL_LISTENER = 'removeAllListeners'; | ||
const EE_LISTENERS = 'listeners'; | ||
const EE_ON = 'on'; | ||
const zoneAwareAddListener = callAndReturnFirstParam( | ||
makeZoneAwareAddListener(EE_ADD_LISTENER, EE_REMOVE_LISTENER, false, true, false)); | ||
const zoneAwarePrependListener = callAndReturnFirstParam( | ||
makeZoneAwareAddListener(EE_PREPEND_LISTENER, EE_REMOVE_LISTENER, false, true, true)); | ||
const zoneAwareRemoveListener = | ||
callAndReturnFirstParam(makeZoneAwareRemoveListener(EE_REMOVE_LISTENER, false)); | ||
const zoneAwareRemoveAllListeners = | ||
callAndReturnFirstParam(makeZoneAwareRemoveAllListeners(EE_REMOVE_ALL_LISTENER)); | ||
const zoneAwareListeners = makeZoneAwareListeners(EE_LISTENERS); | ||
const zoneAwareAddListener = callAndReturnFirstParam( | ||
makeZoneAwareAddListener(EE_ADD_LISTENER, EE_REMOVE_LISTENER, false, true, false)); | ||
const zoneAwarePrependListener = callAndReturnFirstParam( | ||
makeZoneAwareAddListener(EE_PREPEND_LISTENER, EE_REMOVE_LISTENER, false, true, true)); | ||
const zoneAwareRemoveListener = | ||
callAndReturnFirstParam(makeZoneAwareRemoveListener(EE_REMOVE_LISTENER, false)); | ||
const zoneAwareRemoveAllListeners = | ||
callAndReturnFirstParam(makeZoneAwareRemoveAllListeners(EE_REMOVE_ALL_LISTENER)); | ||
const zoneAwareListeners = makeZoneAwareListeners(EE_LISTENERS); | ||
export function patchEventEmitterMethods(obj: any): boolean { | ||
if (obj && obj.addListener) { | ||
patchMethod(obj, EE_ADD_LISTENER, () => zoneAwareAddListener); | ||
patchMethod(obj, EE_PREPEND_LISTENER, () => zoneAwarePrependListener); | ||
patchMethod(obj, EE_REMOVE_LISTENER, () => zoneAwareRemoveListener); | ||
patchMethod(obj, EE_REMOVE_ALL_LISTENER, () => zoneAwareRemoveAllListeners); | ||
patchMethod(obj, EE_LISTENERS, () => zoneAwareListeners); | ||
obj[EE_ON] = obj[EE_ADD_LISTENER]; | ||
return true; | ||
} else { | ||
return false; | ||
function patchEventEmitterMethods(obj: any): boolean { | ||
if (obj && obj.addListener) { | ||
patchMethod(obj, EE_ADD_LISTENER, () => zoneAwareAddListener); | ||
patchMethod(obj, EE_PREPEND_LISTENER, () => zoneAwarePrependListener); | ||
patchMethod(obj, EE_REMOVE_LISTENER, () => zoneAwareRemoveListener); | ||
patchMethod(obj, EE_REMOVE_ALL_LISTENER, () => zoneAwareRemoveAllListeners); | ||
patchMethod(obj, EE_LISTENERS, () => zoneAwareListeners); | ||
obj[EE_ON] = obj[EE_ADD_LISTENER]; | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
} | ||
// EventEmitter | ||
let events; | ||
try { | ||
events = require('events'); | ||
} catch (err) { | ||
} | ||
// EventEmitter | ||
let events; | ||
try { | ||
events = require('events'); | ||
} catch (err) { | ||
} | ||
if (events && events.EventEmitter) { | ||
patchEventEmitterMethods(events.EventEmitter.prototype); | ||
} | ||
if (events && events.EventEmitter) { | ||
patchEventEmitterMethods(events.EventEmitter.prototype); | ||
} | ||
}); |
@@ -11,30 +11,32 @@ /** | ||
let fs: any; | ||
try { | ||
fs = require('fs'); | ||
} catch (err) { | ||
} | ||
Zone.__load_patch('fs', (global: any, Zone: ZoneType, api: _ZonePrivate) => { | ||
let fs: any; | ||
try { | ||
fs = require('fs'); | ||
} catch (err) { | ||
} | ||
// watch, watchFile, unwatchFile has been patched | ||
// because EventEmitter has been patched | ||
const TO_PATCH_MACROTASK_METHODS = [ | ||
'access', 'appendFile', 'chmod', 'chown', 'close', 'exists', 'fchmod', | ||
'fchown', 'fdatasync', 'fstat', 'fsync', 'ftruncate', 'futimes', 'lchmod', | ||
'lchown', 'link', 'lstat', 'mkdir', 'mkdtemp', 'open', 'read', | ||
'readdir', 'readFile', 'readlink', 'realpath', 'rename', 'rmdir', 'stat', | ||
'symlink', 'truncate', 'unlink', 'utimes', 'write', 'writeFile', | ||
]; | ||
// watch, watchFile, unwatchFile has been patched | ||
// because EventEmitter has been patched | ||
const TO_PATCH_MACROTASK_METHODS = [ | ||
'access', 'appendFile', 'chmod', 'chown', 'close', 'exists', 'fchmod', | ||
'fchown', 'fdatasync', 'fstat', 'fsync', 'ftruncate', 'futimes', 'lchmod', | ||
'lchown', 'link', 'lstat', 'mkdir', 'mkdtemp', 'open', 'read', | ||
'readdir', 'readFile', 'readlink', 'realpath', 'rename', 'rmdir', 'stat', | ||
'symlink', 'truncate', 'unlink', 'utimes', 'write', 'writeFile', | ||
]; | ||
if (fs) { | ||
TO_PATCH_MACROTASK_METHODS.filter(name => !!fs[name] && typeof fs[name] === 'function') | ||
.forEach(name => { | ||
patchMacroTask(fs, name, (self: any, args: any[]) => { | ||
return { | ||
name: 'fs.' + name, | ||
args: args, | ||
callbackIndex: args.length > 0 ? args.length - 1 : -1, | ||
target: self | ||
}; | ||
if (fs) { | ||
TO_PATCH_MACROTASK_METHODS.filter(name => !!fs[name] && typeof fs[name] === 'function') | ||
.forEach(name => { | ||
patchMacroTask(fs, name, (self: any, args: any[]) => { | ||
return { | ||
name: 'fs.' + name, | ||
args: args, | ||
callbackIndex: args.length > 0 ? args.length - 1 : -1, | ||
target: self | ||
}; | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
}); |
@@ -9,5 +9,2 @@ /** | ||
import '../zone'; | ||
import '../common/promise'; | ||
import '../common/to-string'; | ||
import './events'; | ||
@@ -17,3 +14,3 @@ import './fs'; | ||
import {patchTimer} from '../common/timers'; | ||
import {findEventTask, patchMacroTask, patchMicroTask} from '../common/utils'; | ||
import {findEventTask, isMix, patchMacroTask, patchMicroTask} from '../common/utils'; | ||
@@ -23,3 +20,3 @@ const set = 'set'; | ||
Zone.__load_patch('timers', (global: any, Zone: ZoneType, api: _ZonePrivate) => { | ||
Zone.__load_patch('node_timers', (global: any, Zone: ZoneType, api: _ZonePrivate) => { | ||
// Timers | ||
@@ -30,4 +27,7 @@ let globalUseTimeoutFromTimer = false; | ||
let globalEqualTimersTimeout = global.setTimeout === timers.setTimeout; | ||
if (!globalEqualTimersTimeout) { | ||
// if global.setTimeout not equal timers.setTimeout, check | ||
if (!globalEqualTimersTimeout && !isMix) { | ||
// 1. if isMix, then we are in mix environment such as Electron | ||
// we should only patch timers.setTimeout because global.setTimeout | ||
// have been patched | ||
// 2. if global.setTimeout not equal timers.setTimeout, check | ||
// whether global.setTimeout use timers.setTimeout or not | ||
@@ -50,2 +50,8 @@ const originSetTimeout = timers.setTimeout; | ||
} | ||
if (isMix) { | ||
// if we are in mix environment, such as Electron, | ||
// the global.setTimeout has already been patched, | ||
// so we just patch timers.setTimeout | ||
return; | ||
} | ||
if (!globalUseTimeoutFromTimer) { | ||
@@ -52,0 +58,0 @@ // 1. global setTimeout equals timers setTimeout |
@@ -317,8 +317,11 @@ /** | ||
interface _ZonePrivate { | ||
currentZoneFrame(): _ZoneFrame; | ||
symbol(name: string): string; | ||
scheduleMicroTask(task?: MicroTask): void; | ||
currentZoneFrame: () => _ZoneFrame; | ||
symbol: (name: string) => string; | ||
scheduleMicroTask: (task?: MicroTask) => void; | ||
onUnhandledError: (error: Error) => void; | ||
microtaskDrainDone: () => void; | ||
showUncaughtError: () => boolean; | ||
patchEventTargetMethods: | ||
(obj: any, addFnName?: string, removeFnName?: string, metaCreator?: any) => boolean; | ||
patchOnProperties: (obj: any, properties: string[]) => void; | ||
} | ||
@@ -760,6 +763,18 @@ | ||
runTask(task: Task, applyThis?: any, applyArgs?: any): any { | ||
if (task.zone != this) | ||
if (task.zone != this) { | ||
throw new Error( | ||
'A task can only be run in the zone of creation! (Creation: ' + | ||
(task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')'); | ||
} | ||
// https://github.com/angular/zone.js/issues/778, sometimes eventTask | ||
// will run in notScheduled(canceled) state, we should not try to | ||
// run such kind of task but just return | ||
// we have to define an variable here, if not | ||
// typescript compiler will complain below | ||
const isNotScheduled = task.state === notScheduled; | ||
if (isNotScheduled && task.type === eventTask) { | ||
return; | ||
} | ||
const reEntryGuard = task.state != running; | ||
@@ -1282,3 +1297,5 @@ reEntryGuard && (task as ZoneTask<any>)._transitionTo(running, scheduled); | ||
scheduleMicroTask: scheduleMicroTask, | ||
showUncaughtError: () => !(Zone as any)[__symbol__('ignoreConsoleErrorUncaughtError')] | ||
showUncaughtError: () => !(Zone as any)[__symbol__('ignoreConsoleErrorUncaughtError')], | ||
patchEventTargetMethods: () => false, | ||
patchOnProperties: noop | ||
}; | ||
@@ -1285,0 +1302,0 @@ let _currentZoneFrame: _ZoneFrame = {parent: null, zone: new Zone(null, null)}; |
{ | ||
"name": "zone.js", | ||
"version": "0.8.10", | ||
"version": "0.8.11", | ||
"description": "Zones for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/zone-node.js", |
@@ -48,2 +48,8 @@ # Zone.js | ||
## Modules | ||
zone.js patches the async APIs which described above, but those patch will have some overhead, | ||
from zone.js v0.8.9, you can choose which web API module you want to patch, for detail, please | ||
see [MODULE.md](MODULE.md) for more details. | ||
## Promise A+ test passed | ||
@@ -50,0 +56,0 @@ [![Promises/A+ 1.1 compliant](https://promisesaplus.com/assets/logo-small.png)](https://promisesaplus.com/) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
677653
68
14023
59