From 74b4b97c1449819d7a96ce6b60ab860c20e7867f Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 14 Mar 2016 16:58:56 -0700 Subject: [PATCH] chore: build --- dist/jasmine-patch.js | 3 +- dist/jasmine-patch.min.js | 2 +- dist/wtf.js | 4 +- dist/wtf.min.js | 2 +- dist/zone-node.js | 7 +--- dist/zone.js | 82 ++++++++++++++++++--------------------- dist/zone.js.d.ts | 4 -- dist/zone.min.js | 2 +- package.json | 2 +- 9 files changed, 47 insertions(+), 61 deletions(-) diff --git a/dist/jasmine-patch.js b/dist/jasmine-patch.js index b987496d0..d50c7e152 100644 --- a/dist/jasmine-patch.js +++ b/dist/jasmine-patch.js @@ -51,6 +51,7 @@ throw new Error('zone.js does not seem to be installed'); } var SET_TIMEOUT = '__zone_symbol__setTimeout'; + var _global = typeof window == 'undefined' ? global : window; // When you have in async test (test with `done` argument) jasmine will // execute the next test synchronously in the done handler. This makes sense // for most tests, but now with zones. With zones running next test @@ -61,7 +62,7 @@ jasmine.QueueRunner = (function (SuperQueueRunner) { // Subclass the `QueueRunner` and override the `clearStack` method. function alwaysClearStack(fn) { - global[SET_TIMEOUT](fn, 0); + _global[SET_TIMEOUT](fn, 0); } function QueueRunner(options) { options.clearStack = alwaysClearStack; diff --git a/dist/jasmine-patch.min.js b/dist/jasmine-patch.min.js index d39397251..16c769ea0 100644 --- a/dist/jasmine-patch.min.js +++ b/dist/jasmine-patch.min.js @@ -1 +1 @@ -!function(e){function n(o){if(t[o])return t[o].exports;var r=t[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}var t={};return n.m=e,n.c=t,n.p="",n(0)}([function(e,exports){(function(e){"use strict";if(!Zone)throw new Error("zone.js does not seem to be installed");var n="__zone_symbol__setTimeout";jasmine.QueueRunner=function(t){function o(t){e[n](t,0)}function r(e){e.clearStack=o,t.call(this,e)}return r.prototype=t.prototype,r}(jasmine.QueueRunner)}).call(exports,function(){return this}())}]); \ No newline at end of file +!function(e){function n(o){if(t[o])return t[o].exports;var r=t[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}var t={};return n.m=e,n.c=t,n.p="",n(0)}([function(e,exports){(function(e){"use strict";if(!Zone)throw new Error("zone.js does not seem to be installed");var n="__zone_symbol__setTimeout",t="undefined"==typeof window?e:window;jasmine.QueueRunner=function(e){function o(e){t[n](e,0)}function r(n){n.clearStack=o,e.call(this,n)}return r.prototype=e.prototype,r}(jasmine.QueueRunner)}).call(exports,function(){return this}())}]); \ No newline at end of file diff --git a/dist/wtf.js b/dist/wtf.js index dbbca2cfe..5f4058ba9 100644 --- a/dist/wtf.js +++ b/dist/wtf.js @@ -44,7 +44,7 @@ /* 0 */ /***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(global) {(function () { + /* WEBPACK VAR INJECTION */(function(global) {(function (global) { ; ; // Detect and setup WTF. @@ -151,7 +151,7 @@ return name; } Zone['wtfZoneSpec'] = !wtfEnabled ? null : new WtfZoneSpec(); - })(); + })(typeof window == 'undefined' ? global : window); /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) diff --git a/dist/wtf.min.js b/dist/wtf.min.js index 6104d2ac6..7b0d6c036 100644 --- a/dist/wtf.min.js +++ b/dist/wtf.min.js @@ -1 +1 @@ -!function(n){function e(r){if(o[r])return o[r].exports;var t=o[r]={exports:{},id:r,loaded:!1};return n[r].call(t.exports,t,t.exports,e),t.loaded=!0,t.exports}var o={};return e.m=n,e.c=o,e.p="",e(0)}([function(n,exports){(function(n){!function(){function e(n,o){if(!o)return null;var r={};for(var t in n)if(n.hasOwnProperty(t)){var a=n[t];switch(typeof a){case"object":var c=a&&a.constructor&&a.constructor.name;a=c==Object.name?e(a,o-1):c;break;case"function":a=a.name||void 0}r[t]=a}return r}function o(n){var e=n.name;for(n=n.parent;null!=n;)e=n.name+"::"+e,n=n.parent;return e}var r=null,t=null,a=function(){var e=n.wtf;return e&&(r=e.trace)?(t=r.events,!0):!1}(),c=function(){function n(){this.name="WTF"}return n.prototype.onFork=function(e,r,t,a){var c=e.fork(t,a);return n.forkInstance(o(t),c.name),c},n.prototype.onInvoke=function(e,a,c,i,s,u,p){var l=n.invokeScope[p];return l||(l=n.invokeScope[p]=t.createScope("Zone:invoke:"+p+"(ascii zone)")),r.leaveScope(l(o(c)),e.invoke(c,i,s,u,p))},n.prototype.onHandleError=function(n,e,o,r){return n.handleError(o,r)},n.prototype.onScheduleTask=function(r,a,c,i){var s=i.type+":"+i.source,u=n.scheduleInstance[s];u||(u=n.scheduleInstance[s]=t.createInstance("Zone:schedule:"+s+"(ascii zone, any data)"));var p=r.scheduleTask(c,i);return u(o(c),e(i.data,2)),p},n.prototype.onInvokeTask=function(e,a,c,i,s,u){var p=i.source,l=n.invokeTaskScope[p];return l||(l=n.invokeTaskScope[p]=t.createScope("Zone:invokeTask:"+p+"(ascii zone)")),r.leaveScope(l(o(c)),e.invokeTask(c,i,s,u))},n.prototype.onCancelTask=function(r,a,c,i){var s=i.source,u=n.cancelInstance[s];u||(u=n.cancelInstance[s]=t.createInstance("Zone:cancel:"+s+"(ascii zone, any options)"));var p=r.cancelTask(c,i);return u(o(c),e(i.data,2)),p},n.forkInstance=a&&t.createInstance("Zone:fork(ascii zone, ascii newZone)"),n.scheduleInstance={},n.cancelInstance={},n.invokeScope={},n.invokeTaskScope={},n}();Zone.wtfZoneSpec=a?new c:null}()}).call(exports,function(){return this}())}]); \ No newline at end of file +!function(n){function e(t){if(o[t])return o[t].exports;var r=o[t]={exports:{},id:t,loaded:!1};return n[t].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var o={};return e.m=n,e.c=o,e.p="",e(0)}([function(n,exports){(function(n){!function(n){function e(n,o){if(!o)return null;var t={};for(var r in n)if(n.hasOwnProperty(r)){var a=n[r];switch(typeof a){case"object":var c=a&&a.constructor&&a.constructor.name;a=c==Object.name?e(a,o-1):c;break;case"function":a=a.name||void 0}t[r]=a}return t}function o(n){var e=n.name;for(n=n.parent;null!=n;)e=n.name+"::"+e,n=n.parent;return e}var t=null,r=null,a=function(){var e=n.wtf;return e&&(t=e.trace)?(r=t.events,!0):!1}(),c=function(){function n(){this.name="WTF"}return n.prototype.onFork=function(e,t,r,a){var c=e.fork(r,a);return n.forkInstance(o(r),c.name),c},n.prototype.onInvoke=function(e,a,c,i,s,u,p){var f=n.invokeScope[p];return f||(f=n.invokeScope[p]=r.createScope("Zone:invoke:"+p+"(ascii zone)")),t.leaveScope(f(o(c)),e.invoke(c,i,s,u,p))},n.prototype.onHandleError=function(n,e,o,t){return n.handleError(o,t)},n.prototype.onScheduleTask=function(t,a,c,i){var s=i.type+":"+i.source,u=n.scheduleInstance[s];u||(u=n.scheduleInstance[s]=r.createInstance("Zone:schedule:"+s+"(ascii zone, any data)"));var p=t.scheduleTask(c,i);return u(o(c),e(i.data,2)),p},n.prototype.onInvokeTask=function(e,a,c,i,s,u){var p=i.source,f=n.invokeTaskScope[p];return f||(f=n.invokeTaskScope[p]=r.createScope("Zone:invokeTask:"+p+"(ascii zone)")),t.leaveScope(f(o(c)),e.invokeTask(c,i,s,u))},n.prototype.onCancelTask=function(t,a,c,i){var s=i.source,u=n.cancelInstance[s];u||(u=n.cancelInstance[s]=r.createInstance("Zone:cancel:"+s+"(ascii zone, any options)"));var p=t.cancelTask(c,i);return u(o(c),e(i.data,2)),p},n.forkInstance=a&&r.createInstance("Zone:fork(ascii zone, ascii newZone)"),n.scheduleInstance={},n.cancelInstance={},n.invokeScope={},n.invokeTaskScope={},n}();Zone.wtfZoneSpec=a?new c:null}("undefined"==typeof window?n:window)}).call(exports,function(){return this}())}]); \ No newline at end of file diff --git a/dist/zone-node.js b/dist/zone-node.js index 953b9c3e2..a8c0af41f 100644 --- a/dist/zone-node.js +++ b/dist/zone-node.js @@ -555,12 +555,7 @@ }; } return global.Zone = Zone; - })((function () { try { - return window; - } - catch (e) { - return global; - } })()); + })(typeof window == 'undefined' ? global : window); /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) diff --git a/dist/zone.js b/dist/zone.js index fe99568f7..a1bc6d27a 100644 --- a/dist/zone.js +++ b/dist/zone.js @@ -54,30 +54,31 @@ var set = 'set'; var clear = 'clear'; var blockingMethods = ['alert', 'prompt', 'confirm']; - patchTimer(global, set, clear, 'Timeout'); - patchTimer(global, set, clear, 'Interval'); - patchTimer(global, set, clear, 'Immediate'); - patchTimer(global, 'request', 'cancelMacroTask', 'AnimationFrame'); - patchTimer(global, 'mozRequest', 'mozCancel', 'AnimationFrame'); - patchTimer(global, 'webkitRequest', 'webkitCancel', 'AnimationFrame'); + var _global = typeof window == 'undefined' ? global : window; + patchTimer(_global, set, clear, 'Timeout'); + patchTimer(_global, set, clear, 'Interval'); + patchTimer(_global, set, clear, 'Immediate'); + patchTimer(_global, 'request', 'cancelMacroTask', 'AnimationFrame'); + patchTimer(_global, 'mozRequest', 'mozCancel', 'AnimationFrame'); + patchTimer(_global, 'webkitRequest', 'webkitCancel', 'AnimationFrame'); for (var i = 0; i < blockingMethods.length; i++) { var name = blockingMethods[i]; - utils_1.patchMethod(global, name, function (delegate, symbol, name) { + utils_1.patchMethod(_global, name, function (delegate, symbol, name) { return function (s, args) { - return Zone.current.run(delegate, global, args, name); + return Zone.current.run(delegate, _global, args, name); }; }); } - event_target_1.eventTargetPatch(); - property_descriptor_1.propertyDescriptorPatch(); + event_target_1.eventTargetPatch(_global); + property_descriptor_1.propertyDescriptorPatch(_global); utils_1.patchClass('MutationObserver'); utils_1.patchClass('WebKitMutationObserver'); utils_1.patchClass('FileReader'); define_property_1.propertyPatch(); - register_element_1.registerElementPatch(); + register_element_1.registerElementPatch(_global); /// GEO_LOCATION - if (global['navigator'] && global['navigator'].geolocation) { - utils_1.patchPrototype(global['navigator'].geolocation, [ + if (_global['navigator'] && _global['navigator'].geolocation) { + utils_1.patchPrototype(_global['navigator'].geolocation, [ 'getCurrentPosition', 'watchPosition' ]); @@ -633,12 +634,7 @@ }; } return global.Zone = Zone; - })((function () { try { - return window; - } - catch (e) { - return global; - } })()); + })(typeof window == 'undefined' ? global : window); /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) @@ -646,19 +642,19 @@ /* 2 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(global) {"use strict"; + "use strict"; var utils_1 = __webpack_require__(3); var WTF_ISSUE_555 = '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'; var NO_EVENT_TARGET = 'ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload'.split(','); var EVENT_TARGET = 'EventTarget'; - function eventTargetPatch() { + function eventTargetPatch(_global) { var apis = []; - var isWtf = global['wtf']; + var isWtf = _global['wtf']; if (isWtf) { // Workaround for: https://github.com/google/tracing-framework/issues/555 apis = WTF_ISSUE_555.split(',').map(function (v) { return 'HTML' + v + 'Element'; }).concat(NO_EVENT_TARGET); } - else if (global[EVENT_TARGET]) { + else if (_global[EVENT_TARGET]) { apis.push(EVENT_TARGET); } else { @@ -667,13 +663,12 @@ apis = NO_EVENT_TARGET; } for (var i = 0; i < apis.length; i++) { - var type = global[apis[i]]; + var type = _global[apis[i]]; utils_1.patchEventTargetMethods(type && type.prototype); } } exports.eventTargetPatch = eventTargetPatch; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 3 */ @@ -681,6 +676,7 @@ /* WEBPACK VAR INJECTION */(function(global) {"use strict"; exports.zoneSymbol = Zone['__symbol__']; + var _global = typeof window == 'undefined' ? global : window; function bindArguments(args, source) { for (var i = args.length - 1; i >= 0; i--) { if (typeof args[i] === 'function') { @@ -809,7 +805,7 @@ // - Inside a Web Worker, `this` is undefined, the context is `global` // - When `addEventListener` is called on the global context in strict mode, `this` is undefined // see https://github.com/angular/zone.js/issues/190 - var target = self || global; + var target = self || _global; var delegate = null; if (typeof handler == 'function') { delegate = handler; @@ -844,7 +840,7 @@ // - Inside a Web Worker, `this` is undefined, the context is `global` // - When `addEventListener` is called on the global context in strict mode, `this` is undefined // see https://github.com/angular/zone.js/issues/190 - var target = self || global; + var target = self || _global; var eventTask = findExistingRegisteredTask(target, handler, eventName, useCapturing, false); if (eventTask) { eventTask.zone.cancelTask(eventTask); @@ -868,10 +864,10 @@ var originalInstanceKey = exports.zoneSymbol('originalInstance'); // wrap some native API on `window` function patchClass(className) { - var OriginalClass = global[className]; + var OriginalClass = _global[className]; if (!OriginalClass) return; - global[className] = function () { + _global[className] = function () { var a = bindArguments(arguments, className); switch (a.length) { case 0: @@ -897,12 +893,12 @@ for (prop in instance) { (function (prop) { if (typeof instance[prop] === 'function') { - global[className].prototype[prop] = function () { + _global[className].prototype[prop] = function () { return this[originalInstanceKey][prop].apply(this[originalInstanceKey], arguments); }; } else { - Object.defineProperty(global[className].prototype, prop, { + Object.defineProperty(_global[className].prototype, prop, { set: function (fn) { if (typeof fn === 'function') { this[originalInstanceKey][prop] = Zone.current.wrap(fn, className + '.' + prop); @@ -920,7 +916,7 @@ } for (prop in OriginalClass) { if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) { - global[className][prop] = OriginalClass[prop]; + _global[className][prop] = OriginalClass[prop]; } } } @@ -1030,11 +1026,11 @@ /* 5 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(global) {"use strict"; + "use strict"; var define_property_1 = __webpack_require__(4); var utils_1 = __webpack_require__(3); - function registerElementPatch() { - if (!utils_1.isBrowser || !('registerElement' in global.document)) { + function registerElementPatch(_global) { + if (!utils_1.isBrowser || !('registerElement' in _global.document)) { return; } var _registerElement = document.registerElement; @@ -1068,7 +1064,6 @@ } exports.registerElementPatch = registerElementPatch; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 6 */ @@ -1078,7 +1073,7 @@ var webSocketPatch = __webpack_require__(7); var utils_1 = __webpack_require__(3); var 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(' '); - function propertyDescriptorPatch() { + function propertyDescriptorPatch(_global) { if (utils_1.isNode) { return; } @@ -1098,7 +1093,7 @@ patchViaCapturingAllTheEvents(); utils_1.patchClass('XMLHttpRequest'); if (supportsWebSocket) { - webSocketPatch.apply(); + webSocketPatch.apply(_global); } } } @@ -1153,17 +1148,17 @@ /* 7 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(global) {"use strict"; + "use strict"; var utils_1 = __webpack_require__(3); // we have to patch the instance since the proto is non-configurable - function apply() { - var WS = global.WebSocket; + function apply(_global) { + var WS = _global.WebSocket; // On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener // On older Chrome, no need since EventTarget was already patched - if (!global.EventTarget) { + if (!_global.EventTarget) { utils_1.patchEventTargetMethods(WS.prototype); } - global.WebSocket = function (a, b) { + _global.WebSocket = function (a, b) { var socket = arguments.length > 1 ? new WS(a, b) : new WS(a); var proxySocket; // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance @@ -1186,7 +1181,6 @@ } exports.apply = apply; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ } /******/ ]); \ No newline at end of file diff --git a/dist/zone.js.d.ts b/dist/zone.js.d.ts index ebd2d14c4..4570228e5 100644 --- a/dist/zone.js.d.ts +++ b/dist/zone.js.d.ts @@ -438,8 +438,4 @@ interface MacroTask extends Task { } interface EventTask extends Task { } -/** @internal */ -declare type AmbientZone = Zone; -/** @internal */ -declare type AmbientZoneDelegate = ZoneDelegate; declare var Zone: ZoneType; diff --git a/dist/zone.min.js b/dist/zone.min.js index 7ac6efdae..aa3049c66 100644 --- a/dist/zone.min.js +++ b/dist/zone.min.js @@ -1 +1 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,exports,t){(function(e){"use strict";function n(e,t,n,r){function o(t){var n=t.data;return n.args[0]=t.invoke,n.handleId=i.apply(e,n.args),t}function a(e){return c(e.data.handleId)}t+=r,n+=r;var i=s.patchMethod(e,t,function(){return function(n,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};return c.scheduleMacroTask(t,s[0],u,o,a)}return i.apply(e,s)}}),c=s.patchMethod(e,n,function(){return function(e,t){var n=t[0];n.zone.cancelTask(n)}})}t(1);var r=t(2),o=t(4),a=t(5),i=t(6),s=t(3),c="set",u="clear",l=["alert","prompt","confirm"];n(e,c,u,"Timeout"),n(e,c,u,"Interval"),n(e,c,u,"Immediate"),n(e,"request","cancelMacroTask","AnimationFrame"),n(e,"mozRequest","mozCancel","AnimationFrame"),n(e,"webkitRequest","webkitCancel","AnimationFrame");for(var h=0;h",this._properties=t&&t.properties||{},this._zoneDelegate=new d(this,this._parent&&this._parent._zoneDelegate,t)}return Object.defineProperty(e,"current",{get:function(){return m},enumerable:!0,configurable:!0}),Object.defineProperty(e,"currentTask",{get:function(){return T},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),e.prototype.get=function(e){for(var t=this;t;){if(t._properties.hasOwnProperty(e))return t._properties[e];t=t._parent}},e.prototype.fork=function(e){if(!e)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)},e.prototype.wrap=function(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);var e=this._zoneDelegate.intercept(this,e,t),n=this;return function(){return n.runGuarded(e,this,arguments,t)}},e.prototype.run=function(e,t,n,r){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null);var o=m;m=this;try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{m=o}},e.prototype.runGuarded=function(e,t,n,r){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null);var o=m;m=this;try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}finally{m=o}},e.prototype.runTask=function(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone which created it! (Creation: "+e.zone.name+"; Execution: "+this.name+")");var r=T;T=e;var o=m;m=this;try{try{return this._zoneDelegate.invokeTask(this,e,t,n)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}finally{m=o,T=r,"microTask"==e.type}},e.prototype.scheduleMicroTask=function(e,t,n,r){return this._zoneDelegate.scheduleTask(this,new v("microTask",this,e,t,n,r,null))},e.prototype.scheduleMacroTask=function(e,t,n,r,o){return this._zoneDelegate.scheduleTask(this,new v("macroTask",this,e,t,n,r,o))},e.prototype.scheduleEventTask=function(e,t,n,r,o){return this._zoneDelegate.scheduleTask(this,new v("eventTask",this,e,t,n,r,o))},e.prototype.cancelTask=function(e){var t=this._zoneDelegate.cancelTask(this,e);return e.cancelFn=null,t},e.__symbol__=t,e}(),d=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._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._hasTaskZS=n&&(n.onHasTask?n:t._hasTaskZS),this._hasTaskDlgt=n&&(n.onHasTask?t:t._hasTaskDlgt)}return e.prototype.fork=function(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new f(e,t)},e.prototype.intercept=function(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this.zone,e,t,n):t},e.prototype.invoke=function(e,t,n,r,o){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this.zone,e,t,n,r,o):t.apply(n,r)},e.prototype.handleError=function(e,t){return this._handleErrorZS?this._handleErrorZS.onHandleError(this._handleErrorDlgt,this.zone,e,t):!0},e.prototype.scheduleTask=function(e,t){try{if(this._scheduleTaskZS)return this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this.zone,e,t);if(t.scheduleFn)t.scheduleFn(t);else{if("microTask"!=t.type)throw new Error("Task is missing scheduleFn.");r(t)}return t}finally{e==this.zone&&this._updateTaskCount(t.type,1)}},e.prototype.invokeTask=function(e,t,n,r){try{return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this.zone,e,t,n,r):t.callback.apply(n,r)}finally{e!=this.zone||"eventTask"==t.type||t.data&&t.data.isPeriodic||this._updateTaskCount(t.type,-1)}},e.prototype.cancelTask=function(e,t){var n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this.zone,e,t);else{if(!t.cancelFn)throw new Error("Task does not support cancellation, or is already canceled.");n=t.cancelFn(t)}return e==this.zone&&this._updateTaskCount(t.type,-1),n},e.prototype.hasTask=function(e,t){return this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this.zone,e,t)},e.prototype._updateTaskCount=function(e,t){var n=this._taskCounts,r=n[e],o=n[e]=r+t;if(0>o)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};try{this.hasTask(this.zone,a)}finally{this._parentDelegate&&this._parentDelegate._updateTaskCount(e,t)}}},e}(),v=function(){function e(e,t,n,r,o,i,s){this.type=e,this.zone=t,this.source=n,this.data=o,this.scheduleFn=i,this.cancelFn=s,this.callback=r;var c=this;this.invoke=function(){try{return t.runTask(c,this,arguments)}finally{a()}}}return e}(),k=t("setTimeout"),g=t("Promise"),y=t("then"),m=new f(null,null),T=null,_=[],b=!1,w=[],E=!1,S=t("state"),P=t("value"),D="Promise.then",z=null,O=!0,Z=!1,C=0,M=function(){function e(e){var t=this;t[S]=z,t[P]=[];try{e&&e(u(t,O),u(t,Z))}catch(n){l(t,!1,n)}}return e.resolve=function(e){return l(new this(null),O,e)},e.reject=function(e){return l(new this(null),Z,e)},e.race=function(e){function t(e){a&&(a=r(e))}function n(e){a&&(a=o(e))}for(var r,o,a=new this(function(e,t){r=e,o=t}),s=0,c=e;s=0;n--)"function"==typeof e[n]&&(e[n]=Zone.current.wrap(e[n],t+"_"+n));return e}function n(e,n){for(var r=e.constructor.name,o=0;o1?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.patchOnProperties(o,["close","error","message","open"]),o}}var r=t(3);exports.apply=n}).call(exports,function(){return this}())}]); \ No newline at end of file +!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,exports,t){(function(e){"use strict";function n(e,t,n,r){function o(t){var n=t.data;return n.args[0]=t.invoke,n.handleId=i.apply(e,n.args),t}function a(e){return c(e.data.handleId)}t+=r,n+=r;var i=s.patchMethod(e,t,function(){return function(n,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};return c.scheduleMacroTask(t,s[0],u,o,a)}return i.apply(e,s)}}),c=s.patchMethod(e,n,function(){return function(e,t){var n=t[0];n.zone.cancelTask(n)}})}t(1);var r=t(2),o=t(4),a=t(5),i=t(6),s=t(3),c="set",u="clear",l=["alert","prompt","confirm"],p="undefined"==typeof window?e:window;n(p,c,u,"Timeout"),n(p,c,u,"Interval"),n(p,c,u,"Immediate"),n(p,"request","cancelMacroTask","AnimationFrame"),n(p,"mozRequest","mozCancel","AnimationFrame"),n(p,"webkitRequest","webkitCancel","AnimationFrame");for(var h=0;h",this._properties=t&&t.properties||{},this._zoneDelegate=new d(this,this._parent&&this._parent._zoneDelegate,t)}return Object.defineProperty(e,"current",{get:function(){return m},enumerable:!0,configurable:!0}),Object.defineProperty(e,"currentTask",{get:function(){return T},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),e.prototype.get=function(e){for(var t=this;t;){if(t._properties.hasOwnProperty(e))return t._properties[e];t=t._parent}},e.prototype.fork=function(e){if(!e)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)},e.prototype.wrap=function(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);var e=this._zoneDelegate.intercept(this,e,t),n=this;return function(){return n.runGuarded(e,this,arguments,t)}},e.prototype.run=function(e,t,n,r){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null);var o=m;m=this;try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{m=o}},e.prototype.runGuarded=function(e,t,n,r){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null);var o=m;m=this;try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}finally{m=o}},e.prototype.runTask=function(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone which created it! (Creation: "+e.zone.name+"; Execution: "+this.name+")");var r=T;T=e;var o=m;m=this;try{try{return this._zoneDelegate.invokeTask(this,e,t,n)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}finally{m=o,T=r,"microTask"==e.type}},e.prototype.scheduleMicroTask=function(e,t,n,r){return this._zoneDelegate.scheduleTask(this,new v("microTask",this,e,t,n,r,null))},e.prototype.scheduleMacroTask=function(e,t,n,r,o){return this._zoneDelegate.scheduleTask(this,new v("macroTask",this,e,t,n,r,o))},e.prototype.scheduleEventTask=function(e,t,n,r,o){return this._zoneDelegate.scheduleTask(this,new v("eventTask",this,e,t,n,r,o))},e.prototype.cancelTask=function(e){var t=this._zoneDelegate.cancelTask(this,e);return e.cancelFn=null,t},e.__symbol__=t,e}(),d=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._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._hasTaskZS=n&&(n.onHasTask?n:t._hasTaskZS),this._hasTaskDlgt=n&&(n.onHasTask?t:t._hasTaskDlgt)}return e.prototype.fork=function(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new f(e,t)},e.prototype.intercept=function(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this.zone,e,t,n):t},e.prototype.invoke=function(e,t,n,r,o){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this.zone,e,t,n,r,o):t.apply(n,r)},e.prototype.handleError=function(e,t){return this._handleErrorZS?this._handleErrorZS.onHandleError(this._handleErrorDlgt,this.zone,e,t):!0},e.prototype.scheduleTask=function(e,t){try{if(this._scheduleTaskZS)return this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this.zone,e,t);if(t.scheduleFn)t.scheduleFn(t);else{if("microTask"!=t.type)throw new Error("Task is missing scheduleFn.");r(t)}return t}finally{e==this.zone&&this._updateTaskCount(t.type,1)}},e.prototype.invokeTask=function(e,t,n,r){try{return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this.zone,e,t,n,r):t.callback.apply(n,r)}finally{e!=this.zone||"eventTask"==t.type||t.data&&t.data.isPeriodic||this._updateTaskCount(t.type,-1)}},e.prototype.cancelTask=function(e,t){var n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this.zone,e,t);else{if(!t.cancelFn)throw new Error("Task does not support cancellation, or is already canceled.");n=t.cancelFn(t)}return e==this.zone&&this._updateTaskCount(t.type,-1),n},e.prototype.hasTask=function(e,t){return this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this.zone,e,t)},e.prototype._updateTaskCount=function(e,t){var n=this._taskCounts,r=n[e],o=n[e]=r+t;if(0>o)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};try{this.hasTask(this.zone,a)}finally{this._parentDelegate&&this._parentDelegate._updateTaskCount(e,t)}}},e}(),v=function(){function e(e,t,n,r,o,i,s){this.type=e,this.zone=t,this.source=n,this.data=o,this.scheduleFn=i,this.cancelFn=s,this.callback=r;var c=this;this.invoke=function(){try{return t.runTask(c,this,arguments)}finally{a()}}}return e}(),k=t("setTimeout"),g=t("Promise"),y=t("then"),m=new f(null,null),T=null,_=[],b=!1,w=[],E=!1,S=t("state"),P=t("value"),D="Promise.then",z=null,O=!0,Z=!1,C=0,M=function(){function e(e){var t=this;t[S]=z,t[P]=[];try{e&&e(u(t,O),u(t,Z))}catch(n){l(t,!1,n)}}return e.resolve=function(e){return l(new this(null),O,e)},e.reject=function(e){return l(new this(null),Z,e)},e.race=function(e){function t(e){a&&(a=r(e))}function n(e){a&&(a=o(e))}for(var r,o,a=new this(function(e,t){r=e,o=t}),s=0,c=e;s=0;n--)"function"==typeof e[n]&&(e[n]=Zone.current.wrap(e[n],t+"_"+n));return e}function n(e,n){for(var r=e.constructor.name,o=0;o1?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.patchOnProperties(o,["close","error","message","open"]),o}}var r=t(3);exports.apply=n}]); \ No newline at end of file diff --git a/package.json b/package.json index 4cdffb7cb..d0f2f8e17 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zone.js", - "version": "0.6.2", + "version": "0.6.3", "description": "Zones for JavaScript", "main": "dist/zone.js", "typings": "dist/zone.js.d.ts",