forked from lthn/blockchain
Merge branch 'frontend' into develop
This commit is contained in:
commit
8941ce100b
9 changed files with 556 additions and 194 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -649,7 +649,7 @@ module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
|
||||||
/*! no static exports found */
|
/*! no static exports found */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
var core = module.exports = { version: '2.6.1' };
|
var core = module.exports = { version: '2.6.2' };
|
||||||
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
|
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1807,7 +1807,7 @@ var store = global[SHARED] || (global[SHARED] = {});
|
||||||
})('versions', []).push({
|
})('versions', []).push({
|
||||||
version: core.version,
|
version: core.version,
|
||||||
mode: __webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js") ? 'pure' : 'global',
|
mode: __webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js") ? 'pure' : 'global',
|
||||||
copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
|
copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2364,7 +2364,6 @@ $metadata.exp({ metadata: function metadata(metadataKey, metadataValue) {
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
var Zone$1 = (function (global) {
|
var Zone$1 = (function (global) {
|
||||||
var FUNCTION = 'function';
|
|
||||||
var performance = global['performance'];
|
var performance = global['performance'];
|
||||||
function mark(name) {
|
function mark(name) {
|
||||||
performance && performance['mark'] && performance['mark'](name);
|
performance && performance['mark'] && performance['mark'](name);
|
||||||
|
|
@ -2373,12 +2372,26 @@ var Zone$1 = (function (global) {
|
||||||
performance && performance['measure'] && performance['measure'](name, label);
|
performance && performance['measure'] && performance['measure'](name, label);
|
||||||
}
|
}
|
||||||
mark('Zone');
|
mark('Zone');
|
||||||
|
var checkDuplicate = global[('__zone_symbol__forceDuplicateZoneCheck')] === true;
|
||||||
if (global['Zone']) {
|
if (global['Zone']) {
|
||||||
throw new Error('Zone already loaded.');
|
// if global['Zone'] already exists (maybe zone.js was already loaded or
|
||||||
|
// some other lib also registered a global object named Zone), we may need
|
||||||
|
// to throw an error, but sometimes user may not want this error.
|
||||||
|
// For example,
|
||||||
|
// we have two web pages, page1 includes zone.js, page2 doesn't.
|
||||||
|
// and the 1st time user load page1 and page2, everything work fine,
|
||||||
|
// but when user load page2 again, error occurs because global['Zone'] already exists.
|
||||||
|
// so we add a flag to let user choose whether to throw this error or not.
|
||||||
|
// By default, if existing Zone is from zone.js, we will not throw the error.
|
||||||
|
if (checkDuplicate || typeof global['Zone'].__symbol__ !== 'function') {
|
||||||
|
throw new Error('Zone already loaded.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return global['Zone'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var Zone = /** @class */ (function () {
|
var Zone = /** @class */ (function () {
|
||||||
function Zone(parent, zoneSpec) {
|
function Zone(parent, zoneSpec) {
|
||||||
this._properties = null;
|
|
||||||
this._parent = parent;
|
this._parent = parent;
|
||||||
this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '<root>';
|
this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '<root>';
|
||||||
this._properties = zoneSpec && zoneSpec.properties || {};
|
this._properties = zoneSpec && zoneSpec.properties || {};
|
||||||
|
|
@ -2421,7 +2434,9 @@ var Zone$1 = (function (global) {
|
||||||
});
|
});
|
||||||
Zone.__load_patch = function (name, fn) {
|
Zone.__load_patch = function (name, fn) {
|
||||||
if (patches.hasOwnProperty(name)) {
|
if (patches.hasOwnProperty(name)) {
|
||||||
throw Error('Already loaded patch: ' + name);
|
if (checkDuplicate) {
|
||||||
|
throw Error('Already loaded patch: ' + name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!global['__Zone_disable_' + name]) {
|
else if (!global['__Zone_disable_' + name]) {
|
||||||
var perfName = 'Zone:' + name;
|
var perfName = 'Zone:' + name;
|
||||||
|
|
@ -2465,7 +2480,7 @@ var Zone$1 = (function (global) {
|
||||||
return this._zoneDelegate.fork(this, zoneSpec);
|
return this._zoneDelegate.fork(this, zoneSpec);
|
||||||
};
|
};
|
||||||
Zone.prototype.wrap = function (callback, source) {
|
Zone.prototype.wrap = function (callback, source) {
|
||||||
if (typeof callback !== FUNCTION) {
|
if (typeof callback !== 'function') {
|
||||||
throw new Error('Expecting function got: ' + callback);
|
throw new Error('Expecting function got: ' + callback);
|
||||||
}
|
}
|
||||||
var _callback = this._zoneDelegate.intercept(this, callback, source);
|
var _callback = this._zoneDelegate.intercept(this, callback, source);
|
||||||
|
|
@ -2475,9 +2490,6 @@ var Zone$1 = (function (global) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
Zone.prototype.run = function (callback, applyThis, applyArgs, source) {
|
Zone.prototype.run = function (callback, applyThis, applyArgs, source) {
|
||||||
if (applyThis === void 0) { applyThis = undefined; }
|
|
||||||
if (applyArgs === void 0) { applyArgs = null; }
|
|
||||||
if (source === void 0) { source = null; }
|
|
||||||
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
||||||
try {
|
try {
|
||||||
return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
|
return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
|
||||||
|
|
@ -2488,8 +2500,6 @@ var Zone$1 = (function (global) {
|
||||||
};
|
};
|
||||||
Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) {
|
Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) {
|
||||||
if (applyThis === void 0) { applyThis = null; }
|
if (applyThis === void 0) { applyThis = null; }
|
||||||
if (applyArgs === void 0) { applyArgs = null; }
|
|
||||||
if (source === void 0) { source = null; }
|
|
||||||
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
|
|
@ -2513,10 +2523,7 @@ var Zone$1 = (function (global) {
|
||||||
// https://github.com/angular/zone.js/issues/778, sometimes eventTask
|
// https://github.com/angular/zone.js/issues/778, sometimes eventTask
|
||||||
// will run in notScheduled(canceled) state, we should not try to
|
// will run in notScheduled(canceled) state, we should not try to
|
||||||
// run such kind of task but just return
|
// run such kind of task but just return
|
||||||
// we have to define an variable here, if not
|
if (task.state === notScheduled && (task.type === eventTask || task.type === macroTask)) {
|
||||||
// typescript compiler will complain below
|
|
||||||
var isNotScheduled = task.state === notScheduled;
|
|
||||||
if (isNotScheduled && task.type === eventTask) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var reEntryGuard = task.state != running;
|
var reEntryGuard = task.state != running;
|
||||||
|
|
@ -2527,7 +2534,7 @@ var Zone$1 = (function (global) {
|
||||||
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
||||||
try {
|
try {
|
||||||
if (task.type == macroTask && task.data && !task.data.isPeriodic) {
|
if (task.type == macroTask && task.data && !task.data.isPeriodic) {
|
||||||
task.cancelFn = null;
|
task.cancelFn = undefined;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
|
return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
|
||||||
|
|
@ -2563,8 +2570,7 @@ var Zone$1 = (function (global) {
|
||||||
var newZone = this;
|
var newZone = this;
|
||||||
while (newZone) {
|
while (newZone) {
|
||||||
if (newZone === task.zone) {
|
if (newZone === task.zone) {
|
||||||
throw Error("can not reschedule task to " + this
|
throw Error("can not reschedule task to " + this.name + " which is descendants of the original zone " + task.zone.name);
|
||||||
.name + " which is descendants of the original zone " + task.zone.name);
|
|
||||||
}
|
}
|
||||||
newZone = newZone.parent;
|
newZone = newZone.parent;
|
||||||
}
|
}
|
||||||
|
|
@ -2594,7 +2600,7 @@ var Zone$1 = (function (global) {
|
||||||
return task;
|
return task;
|
||||||
};
|
};
|
||||||
Zone.prototype.scheduleMicroTask = function (source, callback, data, customSchedule) {
|
Zone.prototype.scheduleMicroTask = function (source, callback, data, customSchedule) {
|
||||||
return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, null));
|
return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, undefined));
|
||||||
};
|
};
|
||||||
Zone.prototype.scheduleMacroTask = function (source, callback, data, customSchedule, customCancel) {
|
Zone.prototype.scheduleMacroTask = function (source, callback, data, customSchedule, customCancel) {
|
||||||
return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));
|
return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));
|
||||||
|
|
@ -2635,16 +2641,14 @@ var Zone$1 = (function (global) {
|
||||||
}());
|
}());
|
||||||
var DELEGATE_ZS = {
|
var DELEGATE_ZS = {
|
||||||
name: '',
|
name: '',
|
||||||
onHasTask: function (delegate, _, target, hasTaskState) {
|
onHasTask: function (delegate, _, target, hasTaskState) { return delegate.hasTask(target, hasTaskState); },
|
||||||
return delegate.hasTask(target, hasTaskState);
|
|
||||||
},
|
|
||||||
onScheduleTask: function (delegate, _, target, task) {
|
onScheduleTask: function (delegate, _, target, task) {
|
||||||
return delegate.scheduleTask(target, task);
|
return delegate.scheduleTask(target, task);
|
||||||
},
|
},
|
||||||
onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) { return delegate.invokeTask(target, task, applyThis, applyArgs); },
|
onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) {
|
||||||
onCancelTask: function (delegate, _, target, task) {
|
return delegate.invokeTask(target, task, applyThis, applyArgs);
|
||||||
return delegate.cancelTask(target, task);
|
},
|
||||||
}
|
onCancelTask: function (delegate, _, target, task) { return delegate.cancelTask(target, task); }
|
||||||
};
|
};
|
||||||
var ZoneDelegate = /** @class */ (function () {
|
var ZoneDelegate = /** @class */ (function () {
|
||||||
function ZoneDelegate(zone, parentDelegate, zoneSpec) {
|
function ZoneDelegate(zone, parentDelegate, zoneSpec) {
|
||||||
|
|
@ -2672,8 +2676,8 @@ var Zone$1 = (function (global) {
|
||||||
zoneSpec && (zoneSpec.onHandleError ? this.zone : parentDelegate.zone);
|
zoneSpec && (zoneSpec.onHandleError ? this.zone : parentDelegate.zone);
|
||||||
this._scheduleTaskZS =
|
this._scheduleTaskZS =
|
||||||
zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);
|
zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);
|
||||||
this._scheduleTaskDlgt =
|
this._scheduleTaskDlgt = zoneSpec &&
|
||||||
zoneSpec && (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
|
(zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
|
||||||
this._scheduleTaskCurrZone =
|
this._scheduleTaskCurrZone =
|
||||||
zoneSpec && (zoneSpec.onScheduleTask ? this.zone : parentDelegate.zone);
|
zoneSpec && (zoneSpec.onScheduleTask ? this.zone : parentDelegate.zone);
|
||||||
this._invokeTaskZS =
|
this._invokeTaskZS =
|
||||||
|
|
@ -2728,8 +2732,7 @@ var Zone$1 = (function (global) {
|
||||||
callback;
|
callback;
|
||||||
};
|
};
|
||||||
ZoneDelegate.prototype.invoke = function (targetZone, callback, applyThis, applyArgs, source) {
|
ZoneDelegate.prototype.invoke = function (targetZone, callback, applyThis, applyArgs, source) {
|
||||||
return this._invokeZS ?
|
return this._invokeZS ? this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :
|
||||||
this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :
|
|
||||||
callback.apply(applyThis, applyArgs);
|
callback.apply(applyThis, applyArgs);
|
||||||
};
|
};
|
||||||
ZoneDelegate.prototype.handleError = function (targetZone, error) {
|
ZoneDelegate.prototype.handleError = function (targetZone, error) {
|
||||||
|
|
@ -2761,8 +2764,7 @@ var Zone$1 = (function (global) {
|
||||||
return returnTask;
|
return returnTask;
|
||||||
};
|
};
|
||||||
ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {
|
ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {
|
||||||
return this._invokeTaskZS ?
|
return this._invokeTaskZS ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :
|
||||||
this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :
|
|
||||||
task.callback.apply(applyThis, applyArgs);
|
task.callback.apply(applyThis, applyArgs);
|
||||||
};
|
};
|
||||||
ZoneDelegate.prototype.cancelTask = function (targetZone, task) {
|
ZoneDelegate.prototype.cancelTask = function (targetZone, task) {
|
||||||
|
|
@ -2782,7 +2784,7 @@ var Zone$1 = (function (global) {
|
||||||
// hasTask should not throw error so other ZoneDelegate
|
// hasTask should not throw error so other ZoneDelegate
|
||||||
// can still trigger hasTask callback
|
// can still trigger hasTask callback
|
||||||
try {
|
try {
|
||||||
return this._hasTaskZS &&
|
this._hasTaskZS &&
|
||||||
this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);
|
this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -2872,14 +2874,12 @@ var Zone$1 = (function (global) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error(this.type + " '" + this.source + "': can not transition to '" + toState + "', expecting state '" + fromState1 + "'" + (fromState2 ?
|
throw new Error(this.type + " '" + this.source + "': can not transition to '" + toState + "', expecting state '" + fromState1 + "'" + (fromState2 ? ' or \'' + fromState2 + '\'' : '') + ", was '" + this._state + "'.");
|
||||||
' or \'' + fromState2 + '\'' :
|
|
||||||
'') + ", was '" + this._state + "'.");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ZoneTask.prototype.toString = function () {
|
ZoneTask.prototype.toString = function () {
|
||||||
if (this.data && typeof this.data.handleId !== 'undefined') {
|
if (this.data && typeof this.data.handleId !== 'undefined') {
|
||||||
return this.data.handleId;
|
return this.data.handleId.toString();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Object.prototype.toString.call(this);
|
return Object.prototype.toString.call(this);
|
||||||
|
|
@ -2920,7 +2920,13 @@ var Zone$1 = (function (global) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nativeMicroTaskQueuePromise) {
|
if (nativeMicroTaskQueuePromise) {
|
||||||
nativeMicroTaskQueuePromise[symbolThen](drainMicroTaskQueue);
|
var nativeThen = nativeMicroTaskQueuePromise[symbolThen];
|
||||||
|
if (!nativeThen) {
|
||||||
|
// native Promise is not patchable, we need to use `then` directly
|
||||||
|
// issue 1078
|
||||||
|
nativeThen = nativeMicroTaskQueuePromise['then'];
|
||||||
|
}
|
||||||
|
nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
global[symbolSetTimeout](drainMicroTaskQueue, 0);
|
global[symbolSetTimeout](drainMicroTaskQueue, 0);
|
||||||
|
|
@ -2967,12 +2973,13 @@ var Zone$1 = (function (global) {
|
||||||
patchEventTarget: function () { return []; },
|
patchEventTarget: function () { return []; },
|
||||||
patchOnProperties: noop,
|
patchOnProperties: noop,
|
||||||
patchMethod: function () { return noop; },
|
patchMethod: function () { return noop; },
|
||||||
bindArguments: function () { return null; },
|
bindArguments: function () { return []; },
|
||||||
|
patchThen: function () { return noop; },
|
||||||
setNativePromise: function (NativePromise) {
|
setNativePromise: function (NativePromise) {
|
||||||
// sometimes NativePromise.resolve static function
|
// sometimes NativePromise.resolve static function
|
||||||
// is not ready yet, (such as core-js/es6.promise)
|
// is not ready yet, (such as core-js/es6.promise)
|
||||||
// so we need to check here.
|
// so we need to check here.
|
||||||
if (NativePromise && typeof NativePromise.resolve === FUNCTION) {
|
if (NativePromise && typeof NativePromise.resolve === 'function') {
|
||||||
nativeMicroTaskQueuePromise = NativePromise.resolve(0);
|
nativeMicroTaskQueuePromise = NativePromise.resolve(0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -2988,6 +2995,16 @@ var Zone$1 = (function (global) {
|
||||||
return global['Zone'] = Zone;
|
return global['Zone'] = Zone;
|
||||||
})(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);
|
})(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);
|
||||||
|
|
||||||
|
var __values = (undefined && undefined.__values) || function (o) {
|
||||||
|
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
||||||
|
if (m) return m.call(o);
|
||||||
|
return {
|
||||||
|
next: function () {
|
||||||
|
if (o && i >= o.length) o = void 0;
|
||||||
|
return { value: o && o[i++], done: !o };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
||||||
var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||||
var ObjectDefineProperty = Object.defineProperty;
|
var ObjectDefineProperty = Object.defineProperty;
|
||||||
|
|
@ -3214,7 +3231,9 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
||||||
chainPromise[symbolParentPromiseState] = promiseState;
|
chainPromise[symbolParentPromiseState] = promiseState;
|
||||||
}
|
}
|
||||||
// should not pass value to finally callback
|
// should not pass value to finally callback
|
||||||
var value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ? [] : [parentPromiseValue]);
|
var value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ?
|
||||||
|
[] :
|
||||||
|
[parentPromiseValue]);
|
||||||
resolvePromise(chainPromise, true, value);
|
resolvePromise(chainPromise, true, value);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
@ -3249,6 +3268,7 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
||||||
return resolvePromise(new this(null), REJECTED, error);
|
return resolvePromise(new this(null), REJECTED, error);
|
||||||
};
|
};
|
||||||
ZoneAwarePromise.race = function (values) {
|
ZoneAwarePromise.race = function (values) {
|
||||||
|
var e_1, _a;
|
||||||
var resolve;
|
var resolve;
|
||||||
var reject;
|
var reject;
|
||||||
var promise = new this(function (res, rej) {
|
var promise = new this(function (res, rej) {
|
||||||
|
|
@ -3261,40 +3281,70 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
||||||
function onReject(error) {
|
function onReject(error) {
|
||||||
promise && (promise = false || reject(error));
|
promise && (promise = false || reject(error));
|
||||||
}
|
}
|
||||||
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
|
try {
|
||||||
var value = values_1[_i];
|
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
||||||
if (!isThenable(value)) {
|
var value = values_1_1.value;
|
||||||
value = this.resolve(value);
|
if (!isThenable(value)) {
|
||||||
|
value = this.resolve(value);
|
||||||
|
}
|
||||||
|
value.then(onResolve, onReject);
|
||||||
}
|
}
|
||||||
value.then(onResolve, onReject);
|
}
|
||||||
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
|
||||||
|
}
|
||||||
|
finally { if (e_1) throw e_1.error; }
|
||||||
}
|
}
|
||||||
return promise;
|
return promise;
|
||||||
};
|
};
|
||||||
ZoneAwarePromise.all = function (values) {
|
ZoneAwarePromise.all = function (values) {
|
||||||
|
var e_2, _a;
|
||||||
var resolve;
|
var resolve;
|
||||||
var reject;
|
var reject;
|
||||||
var promise = new this(function (res, rej) {
|
var promise = new this(function (res, rej) {
|
||||||
resolve = res;
|
resolve = res;
|
||||||
reject = rej;
|
reject = rej;
|
||||||
});
|
});
|
||||||
var count = 0;
|
// Start at 2 to prevent prematurely resolving if .then is called immediately.
|
||||||
|
var unresolvedCount = 2;
|
||||||
|
var valueIndex = 0;
|
||||||
var resolvedValues = [];
|
var resolvedValues = [];
|
||||||
for (var _i = 0, values_2 = values; _i < values_2.length; _i++) {
|
var _loop_2 = function (value) {
|
||||||
var value = values_2[_i];
|
|
||||||
if (!isThenable(value)) {
|
if (!isThenable(value)) {
|
||||||
value = this.resolve(value);
|
value = this_1.resolve(value);
|
||||||
}
|
}
|
||||||
value.then((function (index) { return function (value) {
|
var curValueIndex = valueIndex;
|
||||||
resolvedValues[index] = value;
|
value.then(function (value) {
|
||||||
count--;
|
resolvedValues[curValueIndex] = value;
|
||||||
if (!count) {
|
unresolvedCount--;
|
||||||
|
if (unresolvedCount === 0) {
|
||||||
resolve(resolvedValues);
|
resolve(resolvedValues);
|
||||||
}
|
}
|
||||||
}; })(count), reject);
|
}, reject);
|
||||||
count++;
|
unresolvedCount++;
|
||||||
|
valueIndex++;
|
||||||
|
};
|
||||||
|
var this_1 = this;
|
||||||
|
try {
|
||||||
|
for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
|
||||||
|
var value = values_2_1.value;
|
||||||
|
_loop_2(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!count)
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
|
||||||
|
}
|
||||||
|
finally { if (e_2) throw e_2.error; }
|
||||||
|
}
|
||||||
|
// Make the unresolvedCount zero-based again.
|
||||||
|
unresolvedCount -= 2;
|
||||||
|
if (unresolvedCount === 0) {
|
||||||
resolve(resolvedValues);
|
resolve(resolvedValues);
|
||||||
|
}
|
||||||
return promise;
|
return promise;
|
||||||
};
|
};
|
||||||
ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) {
|
ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) {
|
||||||
|
|
@ -3390,31 +3440,112 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
||||||
};
|
};
|
||||||
Ctor[symbolThenPatched] = true;
|
Ctor[symbolThenPatched] = true;
|
||||||
}
|
}
|
||||||
function zoneify(fn) {
|
api.patchThen = patchThen;
|
||||||
return function () {
|
|
||||||
var resultPromise = fn.apply(this, arguments);
|
|
||||||
if (resultPromise instanceof ZoneAwarePromise) {
|
|
||||||
return resultPromise;
|
|
||||||
}
|
|
||||||
var ctor = resultPromise.constructor;
|
|
||||||
if (!ctor[symbolThenPatched]) {
|
|
||||||
patchThen(ctor);
|
|
||||||
}
|
|
||||||
return resultPromise;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (NativePromise) {
|
if (NativePromise) {
|
||||||
patchThen(NativePromise);
|
patchThen(NativePromise);
|
||||||
var fetch_1 = global['fetch'];
|
|
||||||
if (typeof fetch_1 == 'function') {
|
|
||||||
global['fetch'] = zoneify(fetch_1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// This is not part of public API, but it is useful for tests, so we expose it.
|
// This is not part of public API, but it is useful for tests, so we expose it.
|
||||||
Promise[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors;
|
Promise[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors;
|
||||||
return ZoneAwarePromise;
|
return ZoneAwarePromise;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright Google Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style license that can be
|
||||||
|
* found in the LICENSE file at https://angular.io/license
|
||||||
|
*/
|
||||||
|
Zone.__load_patch('fetch', function (global, Zone, api) {
|
||||||
|
var fetch = global['fetch'];
|
||||||
|
var ZoneAwarePromise = global.Promise;
|
||||||
|
var symbolThenPatched = api.symbol('thenPatched');
|
||||||
|
var fetchTaskScheduling = api.symbol('fetchTaskScheduling');
|
||||||
|
var fetchTaskAborting = api.symbol('fetchTaskAborting');
|
||||||
|
if (typeof fetch !== 'function') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var OriginalAbortController = global['AbortController'];
|
||||||
|
var supportAbort = typeof OriginalAbortController === 'function';
|
||||||
|
var abortNative = null;
|
||||||
|
if (supportAbort) {
|
||||||
|
global['AbortController'] = function () {
|
||||||
|
var abortController = new OriginalAbortController();
|
||||||
|
var signal = abortController.signal;
|
||||||
|
signal.abortController = abortController;
|
||||||
|
return abortController;
|
||||||
|
};
|
||||||
|
abortNative = api.patchMethod(OriginalAbortController.prototype, 'abort', function (delegate) { return function (self, args) {
|
||||||
|
if (self.task) {
|
||||||
|
return self.task.zone.cancelTask(self.task);
|
||||||
|
}
|
||||||
|
return delegate.apply(self, args);
|
||||||
|
}; });
|
||||||
|
}
|
||||||
|
var placeholder = function () { };
|
||||||
|
global['fetch'] = function () {
|
||||||
|
var _this = this;
|
||||||
|
var args = Array.prototype.slice.call(arguments);
|
||||||
|
var options = args.length > 1 ? args[1] : null;
|
||||||
|
var signal = options && options.signal;
|
||||||
|
return new Promise(function (res, rej) {
|
||||||
|
var task = Zone.current.scheduleMacroTask('fetch', placeholder, args, function () {
|
||||||
|
var fetchPromise;
|
||||||
|
var zone = Zone.current;
|
||||||
|
try {
|
||||||
|
zone[fetchTaskScheduling] = true;
|
||||||
|
fetchPromise = fetch.apply(_this, args);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
rej(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
zone[fetchTaskScheduling] = false;
|
||||||
|
}
|
||||||
|
if (!(fetchPromise instanceof ZoneAwarePromise)) {
|
||||||
|
var ctor = fetchPromise.constructor;
|
||||||
|
if (!ctor[symbolThenPatched]) {
|
||||||
|
api.patchThen(ctor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fetchPromise.then(function (resource) {
|
||||||
|
if (task.state !== 'notScheduled') {
|
||||||
|
task.invoke();
|
||||||
|
}
|
||||||
|
res(resource);
|
||||||
|
}, function (error) {
|
||||||
|
if (task.state !== 'notScheduled') {
|
||||||
|
task.invoke();
|
||||||
|
}
|
||||||
|
rej(error);
|
||||||
|
});
|
||||||
|
}, function () {
|
||||||
|
if (!supportAbort) {
|
||||||
|
rej('No AbortController supported, can not cancel fetch');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (signal && signal.abortController && !signal.aborted &&
|
||||||
|
typeof signal.abortController.abort === 'function' && abortNative) {
|
||||||
|
try {
|
||||||
|
Zone.current[fetchTaskAborting] = true;
|
||||||
|
abortNative.call(signal.abortController);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Zone.current[fetchTaskAborting] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rej('cancel fetch need a AbortController.signal');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (signal && signal.abortController) {
|
||||||
|
signal.abortController.task = task;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
* Copyright Google Inc. All Rights Reserved.
|
* Copyright Google Inc. All Rights Reserved.
|
||||||
|
|
@ -3530,9 +3661,23 @@ var wrapFn = function (event) {
|
||||||
}
|
}
|
||||||
var target = this || event.target || _global;
|
var target = this || event.target || _global;
|
||||||
var listener = target[eventNameSymbol];
|
var listener = target[eventNameSymbol];
|
||||||
var result = listener && listener.apply(this, arguments);
|
var result;
|
||||||
if (result != undefined && !result) {
|
if (isBrowser && target === internalWindow && event.type === 'error') {
|
||||||
event.preventDefault();
|
// window.onerror have different signiture
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror#window.onerror
|
||||||
|
// and onerror callback will prevent default when callback return true
|
||||||
|
var errorEvent = event;
|
||||||
|
result = listener &&
|
||||||
|
listener.call(this, errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error);
|
||||||
|
if (result === true) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = listener && listener.apply(this, arguments);
|
||||||
|
if (result != undefined && !result) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
@ -3550,6 +3695,10 @@ function patchProperty(obj, prop, prototype) {
|
||||||
if (!desc || !desc.configurable) {
|
if (!desc || !desc.configurable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var onPropPatchedSymbol = zoneSymbol('on' + prop + 'patched');
|
||||||
|
if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// A property descriptor cannot have getter/setter and be writable
|
// A property descriptor cannot have getter/setter and be writable
|
||||||
// deleting the writable and value properties avoids this error:
|
// deleting the writable and value properties avoids this error:
|
||||||
//
|
//
|
||||||
|
|
@ -3627,6 +3776,7 @@ function patchProperty(obj, prop, prototype) {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
ObjectDefineProperty(obj, prop, desc);
|
ObjectDefineProperty(obj, prop, desc);
|
||||||
|
obj[onPropPatchedSymbol] = true;
|
||||||
}
|
}
|
||||||
function patchOnProperties(obj, properties, prototype) {
|
function patchOnProperties(obj, properties, prototype) {
|
||||||
if (properties) {
|
if (properties) {
|
||||||
|
|
@ -3717,6 +3867,31 @@ function patchClass(className) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function copySymbolProperties(src, dest) {
|
||||||
|
if (typeof Object.getOwnPropertySymbols !== 'function') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var symbols = Object.getOwnPropertySymbols(src);
|
||||||
|
symbols.forEach(function (symbol) {
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(src, symbol);
|
||||||
|
Object.defineProperty(dest, symbol, {
|
||||||
|
get: function () {
|
||||||
|
return src[symbol];
|
||||||
|
},
|
||||||
|
set: function (value) {
|
||||||
|
if (desc && (!desc.writable || typeof desc.set !== 'function')) {
|
||||||
|
// if src[symbol] is not writable or not have a setter, just return
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
src[symbol] = value;
|
||||||
|
},
|
||||||
|
enumerable: desc ? desc.enumerable : true,
|
||||||
|
configurable: desc ? desc.configurable : true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var shouldCopySymbolProperties = false;
|
||||||
|
|
||||||
function patchMethod(target, name, patchFn) {
|
function patchMethod(target, name, patchFn) {
|
||||||
var proto = target;
|
var proto = target;
|
||||||
while (proto && !proto.hasOwnProperty(name)) {
|
while (proto && !proto.hasOwnProperty(name)) {
|
||||||
|
|
@ -3727,7 +3902,7 @@ function patchMethod(target, name, patchFn) {
|
||||||
proto = target;
|
proto = target;
|
||||||
}
|
}
|
||||||
var delegateName = zoneSymbol(name);
|
var delegateName = zoneSymbol(name);
|
||||||
var delegate;
|
var delegate = null;
|
||||||
if (proto && !(delegate = proto[delegateName])) {
|
if (proto && !(delegate = proto[delegateName])) {
|
||||||
delegate = proto[delegateName] = proto[name];
|
delegate = proto[delegateName] = proto[name];
|
||||||
// check whether proto[name] is writable
|
// check whether proto[name] is writable
|
||||||
|
|
@ -3739,6 +3914,9 @@ function patchMethod(target, name, patchFn) {
|
||||||
return patchDelegate_1(this, arguments);
|
return patchDelegate_1(this, arguments);
|
||||||
};
|
};
|
||||||
attachOriginToPatched(proto[name], delegate);
|
attachOriginToPatched(proto[name], delegate);
|
||||||
|
if (shouldCopySymbolProperties) {
|
||||||
|
copySymbolProperties(delegate, proto[name]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return delegate;
|
return delegate;
|
||||||
|
|
@ -3757,7 +3935,7 @@ function patchMacroTask(obj, funcName, metaCreator) {
|
||||||
setNative = patchMethod(obj, funcName, function (delegate) { return function (self, args) {
|
setNative = patchMethod(obj, funcName, function (delegate) { return function (self, args) {
|
||||||
var meta = metaCreator(self, args);
|
var meta = metaCreator(self, args);
|
||||||
if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === 'function') {
|
if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === 'function') {
|
||||||
return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask, null);
|
return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// cause an error by calling it directly.
|
// cause an error by calling it directly.
|
||||||
|
|
@ -3771,6 +3949,17 @@ function attachOriginToPatched(patched, original) {
|
||||||
}
|
}
|
||||||
var isDetectedIEOrEdge = false;
|
var isDetectedIEOrEdge = false;
|
||||||
var ieOrEdge = false;
|
var ieOrEdge = false;
|
||||||
|
function isIE() {
|
||||||
|
try {
|
||||||
|
var ua = internalWindow.navigator.userAgent;
|
||||||
|
if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
function isIEOrEdge() {
|
function isIEOrEdge() {
|
||||||
if (isDetectedIEOrEdge) {
|
if (isDetectedIEOrEdge) {
|
||||||
return ieOrEdge;
|
return ieOrEdge;
|
||||||
|
|
@ -3852,6 +4041,21 @@ Zone.__load_patch('toString', function (global) {
|
||||||
* @fileoverview
|
* @fileoverview
|
||||||
* @suppress {missingRequire}
|
* @suppress {missingRequire}
|
||||||
*/
|
*/
|
||||||
|
var passiveSupported = false;
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
try {
|
||||||
|
var options = Object.defineProperty({}, 'passive', {
|
||||||
|
get: function () {
|
||||||
|
passiveSupported = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
window.addEventListener('test', options, options);
|
||||||
|
window.removeEventListener('test', options, options);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
passiveSupported = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
// an identifier to tell ZoneTask do not create a new invoke closure
|
// an identifier to tell ZoneTask do not create a new invoke closure
|
||||||
var OPTIMIZED_ZONE_EVENT_TASK_DATA = {
|
var OPTIMIZED_ZONE_EVENT_TASK_DATA = {
|
||||||
useG: true
|
useG: true
|
||||||
|
|
@ -3987,6 +4191,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
||||||
if (proto[zoneSymbolAddEventListener]) {
|
if (proto[zoneSymbolAddEventListener]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
var eventNameToString = patchOptions && patchOptions.eventNameToString;
|
||||||
// a shared global taskData to pass data for scheduleEventTask
|
// a shared global taskData to pass data for scheduleEventTask
|
||||||
// so we do not need to create a new object just for pass some data
|
// so we do not need to create a new object just for pass some data
|
||||||
var taskData = {};
|
var taskData = {};
|
||||||
|
|
@ -4002,12 +4207,24 @@ function patchEventTarget(_global, apis, patchOptions) {
|
||||||
nativePrependEventListener = proto[zoneSymbol(patchOptions.prepend)] =
|
nativePrependEventListener = proto[zoneSymbol(patchOptions.prepend)] =
|
||||||
proto[patchOptions.prepend];
|
proto[patchOptions.prepend];
|
||||||
}
|
}
|
||||||
var customScheduleGlobal = function () {
|
function checkIsPassive(task) {
|
||||||
|
if (!passiveSupported && typeof taskData.options !== 'boolean' &&
|
||||||
|
typeof taskData.options !== 'undefined' && taskData.options !== null) {
|
||||||
|
// options is a non-null non-undefined object
|
||||||
|
// passive is not supported
|
||||||
|
// don't pass options as object
|
||||||
|
// just pass capture as a boolean
|
||||||
|
task.options = !!taskData.options.capture;
|
||||||
|
taskData.options = task.options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var customScheduleGlobal = function (task) {
|
||||||
// if there is already a task for the eventName + capture,
|
// if there is already a task for the eventName + capture,
|
||||||
// just return, because we use the shared globalZoneAwareCallback here.
|
// just return, because we use the shared globalZoneAwareCallback here.
|
||||||
if (taskData.isExisting) {
|
if (taskData.isExisting) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
checkIsPassive(task);
|
||||||
return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options);
|
return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options);
|
||||||
};
|
};
|
||||||
var customCancelGlobal = function (task) {
|
var customCancelGlobal = function (task) {
|
||||||
|
|
@ -4048,6 +4265,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
||||||
return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options);
|
return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options);
|
||||||
};
|
};
|
||||||
var customScheduleNonGlobal = function (task) {
|
var customScheduleNonGlobal = function (task) {
|
||||||
|
checkIsPassive(task);
|
||||||
return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);
|
return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);
|
||||||
};
|
};
|
||||||
var customSchedulePrepend = function (task) {
|
var customSchedulePrepend = function (task) {
|
||||||
|
|
@ -4070,10 +4288,15 @@ function patchEventTarget(_global, apis, patchOptions) {
|
||||||
if (prepend === void 0) { prepend = false; }
|
if (prepend === void 0) { prepend = false; }
|
||||||
return function () {
|
return function () {
|
||||||
var target = this || _global;
|
var target = this || _global;
|
||||||
|
var eventName = arguments[0];
|
||||||
var delegate = arguments[1];
|
var delegate = arguments[1];
|
||||||
if (!delegate) {
|
if (!delegate) {
|
||||||
return nativeListener.apply(this, arguments);
|
return nativeListener.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
if (isNode && eventName === 'uncaughtException') {
|
||||||
|
// don't patch uncaughtException of nodejs to prevent endless loop
|
||||||
|
return nativeListener.apply(this, arguments);
|
||||||
|
}
|
||||||
// don't create the bind delegate function for handleEvent
|
// don't create the bind delegate function for handleEvent
|
||||||
// case here to improve addEventListener performance
|
// case here to improve addEventListener performance
|
||||||
// we will create the bind delegate when invoke
|
// we will create the bind delegate when invoke
|
||||||
|
|
@ -4087,7 +4310,6 @@ function patchEventTarget(_global, apis, patchOptions) {
|
||||||
if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) {
|
if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var eventName = arguments[0];
|
|
||||||
var options = arguments[2];
|
var options = arguments[2];
|
||||||
if (blackListedEvents) {
|
if (blackListedEvents) {
|
||||||
// check black list
|
// check black list
|
||||||
|
|
@ -4117,8 +4339,8 @@ function patchEventTarget(_global, apis, patchOptions) {
|
||||||
var symbolEventName;
|
var symbolEventName;
|
||||||
if (!symbolEventNames) {
|
if (!symbolEventNames) {
|
||||||
// the code is duplicate, but I just want to get some better performance
|
// the code is duplicate, but I just want to get some better performance
|
||||||
var falseEventName = eventName + FALSE_STR;
|
var falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR;
|
||||||
var trueEventName = eventName + TRUE_STR;
|
var trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR;
|
||||||
var symbol = ZONE_SYMBOL_PREFIX + falseEventName;
|
var symbol = ZONE_SYMBOL_PREFIX + falseEventName;
|
||||||
var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
|
var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
|
||||||
zoneSymbolEventNames$1[eventName] = {};
|
zoneSymbolEventNames$1[eventName] = {};
|
||||||
|
|
@ -4153,7 +4375,8 @@ function patchEventTarget(_global, apis, patchOptions) {
|
||||||
source = targetSource[eventName];
|
source = targetSource[eventName];
|
||||||
}
|
}
|
||||||
if (!source) {
|
if (!source) {
|
||||||
source = constructorName + addSource + eventName;
|
source = constructorName + addSource +
|
||||||
|
(eventNameToString ? eventNameToString(eventName) : eventName);
|
||||||
}
|
}
|
||||||
// do not create a new object as task.data to pass those things
|
// do not create a new object as task.data to pass those things
|
||||||
// just use the global shared one
|
// just use the global shared one
|
||||||
|
|
@ -4168,7 +4391,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
||||||
taskData.capture = capture;
|
taskData.capture = capture;
|
||||||
taskData.eventName = eventName;
|
taskData.eventName = eventName;
|
||||||
taskData.isExisting = isExisting;
|
taskData.isExisting = isExisting;
|
||||||
var data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : null;
|
var data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : undefined;
|
||||||
// keep taskData into data to allow onScheduleEventTask to access the task information
|
// keep taskData into data to allow onScheduleEventTask to access the task information
|
||||||
if (data) {
|
if (data) {
|
||||||
data.taskData = taskData;
|
data.taskData = taskData;
|
||||||
|
|
@ -4186,7 +4409,11 @@ function patchEventTarget(_global, apis, patchOptions) {
|
||||||
if (once) {
|
if (once) {
|
||||||
options.once = true;
|
options.once = true;
|
||||||
}
|
}
|
||||||
task.options = options;
|
if (!(!passiveSupported && typeof task.options === 'boolean')) {
|
||||||
|
// if not support passive, and we pass an option object
|
||||||
|
// to addEventListener, we should save the options to task
|
||||||
|
task.options = options;
|
||||||
|
}
|
||||||
task.target = target;
|
task.target = target;
|
||||||
task.capture = capture;
|
task.capture = capture;
|
||||||
task.eventName = eventName;
|
task.eventName = eventName;
|
||||||
|
|
@ -4271,7 +4498,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
||||||
var target = this || _global;
|
var target = this || _global;
|
||||||
var eventName = arguments[0];
|
var eventName = arguments[0];
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var tasks = findEventTasks(target, eventName);
|
var tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName);
|
||||||
for (var i = 0; i < tasks.length; i++) {
|
for (var i = 0; i < tasks.length; i++) {
|
||||||
var task = tasks[i];
|
var task = tasks[i];
|
||||||
var delegate = task.originalDelegate ? task.originalDelegate : task.callback;
|
var delegate = task.originalDelegate ? task.originalDelegate : task.callback;
|
||||||
|
|
@ -4427,9 +4654,9 @@ function patchTimer(window, setName, cancelName, nameSuffix) {
|
||||||
patchMethod(window, setName, function (delegate) { return function (self, args) {
|
patchMethod(window, setName, function (delegate) { return function (self, args) {
|
||||||
if (typeof args[0] === 'function') {
|
if (typeof args[0] === 'function') {
|
||||||
var options = {
|
var options = {
|
||||||
handleId: null,
|
|
||||||
isPeriodic: nameSuffix === 'Interval',
|
isPeriodic: nameSuffix === 'Interval',
|
||||||
delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 : null,
|
delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 :
|
||||||
|
undefined,
|
||||||
args: args
|
args: args
|
||||||
};
|
};
|
||||||
var task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask);
|
var task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask);
|
||||||
|
|
@ -4544,7 +4771,7 @@ function propertyPatch() {
|
||||||
};
|
};
|
||||||
Object.getOwnPropertyDescriptor = function (obj, prop) {
|
Object.getOwnPropertyDescriptor = function (obj, prop) {
|
||||||
var desc = _getOwnPropertyDescriptor(obj, prop);
|
var desc = _getOwnPropertyDescriptor(obj, prop);
|
||||||
if (isUnconfigurable(obj, prop)) {
|
if (desc && isUnconfigurable(obj, prop)) {
|
||||||
desc.configurable = false;
|
desc.configurable = false;
|
||||||
}
|
}
|
||||||
return desc;
|
return desc;
|
||||||
|
|
@ -4772,10 +4999,10 @@ var globalEventHandlersEventNames = [
|
||||||
'wheel'
|
'wheel'
|
||||||
];
|
];
|
||||||
var documentEventNames = [
|
var documentEventNames = [
|
||||||
'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'fullscreenchange',
|
'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'freeze', 'fullscreenchange',
|
||||||
'mozfullscreenchange', 'webkitfullscreenchange', 'msfullscreenchange', 'fullscreenerror',
|
'mozfullscreenchange', 'webkitfullscreenchange', 'msfullscreenchange', 'fullscreenerror',
|
||||||
'mozfullscreenerror', 'webkitfullscreenerror', 'msfullscreenerror', 'readystatechange',
|
'mozfullscreenerror', 'webkitfullscreenerror', 'msfullscreenerror', 'readystatechange',
|
||||||
'visibilitychange'
|
'visibilitychange', 'resume'
|
||||||
];
|
];
|
||||||
var windowEventNames = [
|
var windowEventNames = [
|
||||||
'absolutedeviceorientation',
|
'absolutedeviceorientation',
|
||||||
|
|
@ -4887,7 +5114,7 @@ var websocketEventNames = ['close', 'error', 'open', 'message'];
|
||||||
var workerEventNames = ['error', 'message'];
|
var workerEventNames = ['error', 'message'];
|
||||||
var eventNames = globalEventHandlersEventNames.concat(webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames, htmlElementEventNames, ieElementEventNames);
|
var eventNames = globalEventHandlersEventNames.concat(webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames, htmlElementEventNames, ieElementEventNames);
|
||||||
function filterProperties(target, onProperties, ignoreProperties) {
|
function filterProperties(target, onProperties, ignoreProperties) {
|
||||||
if (!ignoreProperties) {
|
if (!ignoreProperties || ignoreProperties.length === 0) {
|
||||||
return onProperties;
|
return onProperties;
|
||||||
}
|
}
|
||||||
var tip = ignoreProperties.filter(function (ip) { return ip.target === target; });
|
var tip = ignoreProperties.filter(function (ip) { return ip.target === target; });
|
||||||
|
|
@ -4912,13 +5139,14 @@ function propertyDescriptorPatch(api, _global) {
|
||||||
}
|
}
|
||||||
var supportsWebSocket = typeof WebSocket !== 'undefined';
|
var supportsWebSocket = typeof WebSocket !== 'undefined';
|
||||||
if (canPatchViaPropertyDescriptor()) {
|
if (canPatchViaPropertyDescriptor()) {
|
||||||
var ignoreProperties = _global.__Zone_ignore_on_properties;
|
var ignoreProperties = _global['__Zone_ignore_on_properties'];
|
||||||
// for browsers that we can patch the descriptor: Chrome & Firefox
|
// for browsers that we can patch the descriptor: Chrome & Firefox
|
||||||
if (isBrowser) {
|
if (isBrowser) {
|
||||||
var internalWindow = window;
|
var internalWindow = window;
|
||||||
|
var ignoreErrorProperties = isIE ? [{ target: internalWindow, ignoreProperties: ['error'] }] : [];
|
||||||
// in IE/Edge, onProp not exist in window object, but in WindowPrototype
|
// in IE/Edge, onProp not exist in window object, but in WindowPrototype
|
||||||
// so we need to pass WindowPrototype to check onProp exist or not
|
// so we need to pass WindowPrototype to check onProp exist or not
|
||||||
patchFilteredProperties(internalWindow, eventNames.concat(['messageerror']), ignoreProperties, ObjectGetPrototypeOf(internalWindow));
|
patchFilteredProperties(internalWindow, eventNames.concat(['messageerror']), ignoreProperties ? ignoreProperties.concat(ignoreErrorProperties) : ignoreProperties, ObjectGetPrototypeOf(internalWindow));
|
||||||
patchFilteredProperties(Document.prototype, eventNames, ignoreProperties);
|
patchFilteredProperties(Document.prototype, eventNames, ignoreProperties);
|
||||||
if (typeof internalWindow['SVGElement'] !== 'undefined') {
|
if (typeof internalWindow['SVGElement'] !== 'undefined') {
|
||||||
patchFilteredProperties(internalWindow['SVGElement'].prototype, eventNames, ignoreProperties);
|
patchFilteredProperties(internalWindow['SVGElement'].prototype, eventNames, ignoreProperties);
|
||||||
|
|
@ -4940,9 +5168,9 @@ function propertyDescriptorPatch(api, _global) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties);
|
patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties);
|
||||||
var XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget'];
|
var XMLHttpRequestEventTarget_1 = _global['XMLHttpRequestEventTarget'];
|
||||||
if (XMLHttpRequestEventTarget) {
|
if (XMLHttpRequestEventTarget_1) {
|
||||||
patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties);
|
patchFilteredProperties(XMLHttpRequestEventTarget_1 && XMLHttpRequestEventTarget_1.prototype, XMLHttpRequestEventNames, ignoreProperties);
|
||||||
}
|
}
|
||||||
if (typeof IDBIndex !== 'undefined') {
|
if (typeof IDBIndex !== 'undefined') {
|
||||||
patchFilteredProperties(IDBIndex.prototype, IDBIndexEventNames, ignoreProperties);
|
patchFilteredProperties(IDBIndex.prototype, IDBIndexEventNames, ignoreProperties);
|
||||||
|
|
@ -5157,16 +5385,16 @@ function patchEvent(global, api) {
|
||||||
* Use of this source code is governed by an MIT-style license that can be
|
* Use of this source code is governed by an MIT-style license that can be
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
function registerElementPatch(_global) {
|
function patchCallbacks(target, targetName, method, callbacks) {
|
||||||
if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) {
|
var symbol = Zone.__symbol__(method);
|
||||||
|
if (target[symbol]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var _registerElement = document.registerElement;
|
var nativeDelegate = target[symbol] = target[method];
|
||||||
var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback'];
|
target[method] = function (name, opts, options) {
|
||||||
document.registerElement = function (name, opts) {
|
|
||||||
if (opts && opts.prototype) {
|
if (opts && opts.prototype) {
|
||||||
callbacks.forEach(function (callback) {
|
callbacks.forEach(function (callback) {
|
||||||
var source = 'Document.registerElement::' + callback;
|
var source = targetName + "." + method + "::" + callback;
|
||||||
var prototype = opts.prototype;
|
var prototype = opts.prototype;
|
||||||
if (prototype.hasOwnProperty(callback)) {
|
if (prototype.hasOwnProperty(callback)) {
|
||||||
var descriptor = ObjectGetOwnPropertyDescriptor(prototype, callback);
|
var descriptor = ObjectGetOwnPropertyDescriptor(prototype, callback);
|
||||||
|
|
@ -5183,9 +5411,23 @@ function registerElementPatch(_global) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return _registerElement.call(document, name, opts);
|
return nativeDelegate.call(target, name, opts, options);
|
||||||
};
|
};
|
||||||
attachOriginToPatched(document.registerElement, _registerElement);
|
attachOriginToPatched(target[method], nativeDelegate);
|
||||||
|
}
|
||||||
|
function registerElementPatch(_global) {
|
||||||
|
if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback'];
|
||||||
|
patchCallbacks(document, 'Document', 'registerElement', callbacks);
|
||||||
|
}
|
||||||
|
function patchCustomElements(_global) {
|
||||||
|
if ((!isBrowser && !isMix) || !('customElements' in _global)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback'];
|
||||||
|
patchCallbacks(_global.customElements, 'customElements', 'define', callbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -5248,7 +5490,10 @@ Zone.__load_patch('EventTarget', function (global, Zone, api) {
|
||||||
Zone.__load_patch('on_property', function (global, Zone, api) {
|
Zone.__load_patch('on_property', function (global, Zone, api) {
|
||||||
propertyDescriptorPatch(api, global);
|
propertyDescriptorPatch(api, global);
|
||||||
propertyPatch();
|
propertyPatch();
|
||||||
|
});
|
||||||
|
Zone.__load_patch('customElements', function (global, Zone, api) {
|
||||||
registerElementPatch(global);
|
registerElementPatch(global);
|
||||||
|
patchCustomElements(global);
|
||||||
});
|
});
|
||||||
Zone.__load_patch('canvas', function (global) {
|
Zone.__load_patch('canvas', function (global) {
|
||||||
var HTMLCanvasElement = global['HTMLCanvasElement'];
|
var HTMLCanvasElement = global['HTMLCanvasElement'];
|
||||||
|
|
@ -5267,6 +5512,7 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
||||||
var XHR_LISTENER = zoneSymbol('xhrListener');
|
var XHR_LISTENER = zoneSymbol('xhrListener');
|
||||||
var XHR_SCHEDULED = zoneSymbol('xhrScheduled');
|
var XHR_SCHEDULED = zoneSymbol('xhrScheduled');
|
||||||
var XHR_URL = zoneSymbol('xhrURL');
|
var XHR_URL = zoneSymbol('xhrURL');
|
||||||
|
var XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled');
|
||||||
function patchXHR(window) {
|
function patchXHR(window) {
|
||||||
var XMLHttpRequestPrototype = XMLHttpRequest.prototype;
|
var XMLHttpRequestPrototype = XMLHttpRequest.prototype;
|
||||||
function findPendingTask(target) {
|
function findPendingTask(target) {
|
||||||
|
|
@ -5275,9 +5521,9 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
||||||
var oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
|
var oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
|
||||||
var oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
|
var oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
|
||||||
if (!oriAddListener) {
|
if (!oriAddListener) {
|
||||||
var XMLHttpRequestEventTarget = window['XMLHttpRequestEventTarget'];
|
var XMLHttpRequestEventTarget_1 = window['XMLHttpRequestEventTarget'];
|
||||||
if (XMLHttpRequestEventTarget) {
|
if (XMLHttpRequestEventTarget_1) {
|
||||||
var XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget.prototype;
|
var XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget_1.prototype;
|
||||||
oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
|
oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
|
||||||
oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
|
oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
|
||||||
}
|
}
|
||||||
|
|
@ -5285,9 +5531,10 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
||||||
var READY_STATE_CHANGE = 'readystatechange';
|
var READY_STATE_CHANGE = 'readystatechange';
|
||||||
var SCHEDULED = 'scheduled';
|
var SCHEDULED = 'scheduled';
|
||||||
function scheduleTask(task) {
|
function scheduleTask(task) {
|
||||||
XMLHttpRequest[XHR_SCHEDULED] = false;
|
|
||||||
var data = task.data;
|
var data = task.data;
|
||||||
var target = data.target;
|
var target = data.target;
|
||||||
|
target[XHR_SCHEDULED] = false;
|
||||||
|
target[XHR_ERROR_BEFORE_SCHEDULED] = false;
|
||||||
// remove existing event listener
|
// remove existing event listener
|
||||||
var listener = target[XHR_LISTENER];
|
var listener = target[XHR_LISTENER];
|
||||||
if (!oriAddListener) {
|
if (!oriAddListener) {
|
||||||
|
|
@ -5301,8 +5548,35 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
||||||
if (target.readyState === target.DONE) {
|
if (target.readyState === target.DONE) {
|
||||||
// sometimes on some browsers XMLHttpRequest will fire onreadystatechange with
|
// sometimes on some browsers XMLHttpRequest will fire onreadystatechange with
|
||||||
// readyState=4 multiple times, so we need to check task state here
|
// readyState=4 multiple times, so we need to check task state here
|
||||||
if (!data.aborted && XMLHttpRequest[XHR_SCHEDULED] && task.state === SCHEDULED) {
|
if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) {
|
||||||
task.invoke();
|
// check whether the xhr has registered onload listener
|
||||||
|
// if that is the case, the task should invoke after all
|
||||||
|
// onload listeners finish.
|
||||||
|
var loadTasks = target['__zone_symbol__loadfalse'];
|
||||||
|
if (loadTasks && loadTasks.length > 0) {
|
||||||
|
var oriInvoke_1 = task.invoke;
|
||||||
|
task.invoke = function () {
|
||||||
|
// need to load the tasks again, because in other
|
||||||
|
// load listener, they may remove themselves
|
||||||
|
var loadTasks = target['__zone_symbol__loadfalse'];
|
||||||
|
for (var i = 0; i < loadTasks.length; i++) {
|
||||||
|
if (loadTasks[i] === task) {
|
||||||
|
loadTasks.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!data.aborted && task.state === SCHEDULED) {
|
||||||
|
oriInvoke_1.call(task);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
loadTasks.push(task);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
task.invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!data.aborted && target[XHR_SCHEDULED] === false) {
|
||||||
|
// error occurs when xhr.send()
|
||||||
|
target[XHR_ERROR_BEFORE_SCHEDULED] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -5312,7 +5586,7 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
||||||
target[XHR_TASK] = task;
|
target[XHR_TASK] = task;
|
||||||
}
|
}
|
||||||
sendNative.apply(target, data.args);
|
sendNative.apply(target, data.args);
|
||||||
XMLHttpRequest[XHR_SCHEDULED] = true;
|
target[XHR_SCHEDULED] = true;
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
function placeholderCallback() { }
|
function placeholderCallback() { }
|
||||||
|
|
@ -5329,24 +5603,32 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
||||||
return openNative.apply(self, args);
|
return openNative.apply(self, args);
|
||||||
}; });
|
}; });
|
||||||
var XMLHTTPREQUEST_SOURCE = 'XMLHttpRequest.send';
|
var XMLHTTPREQUEST_SOURCE = 'XMLHttpRequest.send';
|
||||||
|
var fetchTaskAborting = zoneSymbol('fetchTaskAborting');
|
||||||
|
var fetchTaskScheduling = zoneSymbol('fetchTaskScheduling');
|
||||||
var sendNative = patchMethod(XMLHttpRequestPrototype, 'send', function () { return function (self, args) {
|
var sendNative = patchMethod(XMLHttpRequestPrototype, 'send', function () { return function (self, args) {
|
||||||
|
if (Zone.current[fetchTaskScheduling] === true) {
|
||||||
|
// a fetch is scheduling, so we are using xhr to polyfill fetch
|
||||||
|
// and because we already schedule macroTask for fetch, we should
|
||||||
|
// not schedule a macroTask for xhr again
|
||||||
|
return sendNative.apply(self, args);
|
||||||
|
}
|
||||||
if (self[XHR_SYNC]) {
|
if (self[XHR_SYNC]) {
|
||||||
// if the XHR is sync there is no task to schedule, just execute the code.
|
// if the XHR is sync there is no task to schedule, just execute the code.
|
||||||
return sendNative.apply(self, args);
|
return sendNative.apply(self, args);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var options = {
|
var options = { target: self, url: self[XHR_URL], isPeriodic: false, args: args, aborted: false };
|
||||||
target: self,
|
var task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);
|
||||||
url: self[XHR_URL],
|
if (self && self[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted &&
|
||||||
isPeriodic: false,
|
task.state === SCHEDULED) {
|
||||||
delay: null,
|
// xhr request throw error when send
|
||||||
args: args,
|
// we should invoke task instead of leaving a scheduled
|
||||||
aborted: false
|
// pending macroTask
|
||||||
};
|
task.invoke();
|
||||||
return scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);
|
}
|
||||||
}
|
}
|
||||||
}; });
|
}; });
|
||||||
var abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', function () { return function (self) {
|
var abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', function () { return function (self, args) {
|
||||||
var task = findPendingTask(self);
|
var task = findPendingTask(self);
|
||||||
if (task && typeof task.type == 'string') {
|
if (task && typeof task.type == 'string') {
|
||||||
// If the XHR has already completed, do nothing.
|
// If the XHR has already completed, do nothing.
|
||||||
|
|
@ -5358,6 +5640,10 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
||||||
}
|
}
|
||||||
task.zone.cancelTask(task);
|
task.zone.cancelTask(task);
|
||||||
}
|
}
|
||||||
|
else if (Zone.current[fetchTaskAborting] === true) {
|
||||||
|
// the abort is called from fetch polyfill, we need to call native abort of XHR.
|
||||||
|
return abortNative.apply(self, args);
|
||||||
|
}
|
||||||
// Otherwise, we are trying to abort an XHR which has not yet been sent, so there is no
|
// Otherwise, we are trying to abort an XHR which has not yet been sent, so there is no
|
||||||
// task
|
// task
|
||||||
// to cancel. Do nothing.
|
// to cancel. Do nothing.
|
||||||
|
|
@ -5497,8 +5783,8 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
/*! no static exports found */
|
/*! no static exports found */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
__webpack_require__(/*! D:\Projects\Zano\src\gui\qt-daemon\html_source\src\polyfills.ts */"./src/polyfills.ts");
|
__webpack_require__(/*! D:\zano_zano\src\gui\qt-daemon\html_source\src\polyfills.ts */"./src/polyfills.ts");
|
||||||
module.exports = __webpack_require__(/*! D:\Projects\Zano\src\gui\qt-daemon\html_source\node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\jit-polyfills.js */"./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js");
|
module.exports = __webpack_require__(/*! D:\zano_zano\src\gui\qt-daemon\html_source\node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\jit-polyfills.js */"./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js");
|
||||||
|
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -93682,6 +93682,22 @@ var NotIdle = /** @class */ (function (_super) {
|
||||||
|
|
||||||
//# sourceMappingURL=/home/travis/build/harunurhan/idlejs/src/not-idle.js.map
|
//# sourceMappingURL=/home/travis/build/harunurhan/idlejs/src/not-idle.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./node_modules/isarray/index.js":
|
||||||
|
/*!***************************************!*\
|
||||||
|
!*** ./node_modules/isarray/index.js ***!
|
||||||
|
\***************************************/
|
||||||
|
/*! no static exports found */
|
||||||
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
|
var toString = {}.toString;
|
||||||
|
|
||||||
|
module.exports = Array.isArray || function (arr) {
|
||||||
|
return toString.call(arr) == '[object Array]';
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./node_modules/json-bignumber/node_modules/bignumber.js/bignumber.js":
|
/***/ "./node_modules/json-bignumber/node_modules/bignumber.js/bignumber.js":
|
||||||
|
|
@ -98854,9 +98870,13 @@ exports.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {
|
||||||
|
|
||||||
var Buffer = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js")
|
var Buffer = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js")
|
||||||
|
|
||||||
var EXP_TABLE = new Buffer(512)
|
if(Buffer.alloc) {
|
||||||
var LOG_TABLE = new Buffer(256)
|
var EXP_TABLE = Buffer.alloc(512)
|
||||||
|
var LOG_TABLE = Buffer.alloc(256)
|
||||||
|
} else {
|
||||||
|
var EXP_TABLE = new Buffer(512)
|
||||||
|
var LOG_TABLE = new Buffer(256)
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Precompute the log and anti-log tables for faster computation later
|
* Precompute the log and anti-log tables for faster computation later
|
||||||
*
|
*
|
||||||
|
|
@ -99566,7 +99586,7 @@ var Version = __webpack_require__(/*! ./version */ "./node_modules/qrcode/lib/co
|
||||||
var FormatInfo = __webpack_require__(/*! ./format-info */ "./node_modules/qrcode/lib/core/format-info.js")
|
var FormatInfo = __webpack_require__(/*! ./format-info */ "./node_modules/qrcode/lib/core/format-info.js")
|
||||||
var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
||||||
var Segments = __webpack_require__(/*! ./segments */ "./node_modules/qrcode/lib/core/segments.js")
|
var Segments = __webpack_require__(/*! ./segments */ "./node_modules/qrcode/lib/core/segments.js")
|
||||||
var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js")
|
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* QRCode for JavaScript
|
* QRCode for JavaScript
|
||||||
|
|
@ -100614,7 +100634,7 @@ var ECCode = __webpack_require__(/*! ./error-correction-code */ "./node_modules/
|
||||||
var ECLevel = __webpack_require__(/*! ./error-correction-level */ "./node_modules/qrcode/lib/core/error-correction-level.js")
|
var ECLevel = __webpack_require__(/*! ./error-correction-level */ "./node_modules/qrcode/lib/core/error-correction-level.js")
|
||||||
var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
|
||||||
var VersionCheck = __webpack_require__(/*! ./version-check */ "./node_modules/qrcode/lib/core/version-check.js")
|
var VersionCheck = __webpack_require__(/*! ./version-check */ "./node_modules/qrcode/lib/core/version-check.js")
|
||||||
var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js")
|
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
|
||||||
|
|
||||||
// Generator polynomial used to encode version information
|
// Generator polynomial used to encode version information
|
||||||
var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)
|
var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)
|
||||||
|
|
@ -101064,7 +101084,7 @@ exports.qrToImageData = function qrToImageData (imgData, qr, opts) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js")
|
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
|
||||||
|
|
||||||
function typedArraySupport () {
|
function typedArraySupport () {
|
||||||
// Can typed array instances be augmented?
|
// Can typed array instances be augmented?
|
||||||
|
|
@ -101569,22 +101589,6 @@ Buffer.isBuffer = function isBuffer (b) {
|
||||||
module.exports = Buffer
|
module.exports = Buffer
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ "./node_modules/qrcode/node_modules/isarray/index.js":
|
|
||||||
/*!***********************************************************!*\
|
|
||||||
!*** ./node_modules/qrcode/node_modules/isarray/index.js ***!
|
|
||||||
\***********************************************************/
|
|
||||||
/*! no static exports found */
|
|
||||||
/***/ (function(module, exports) {
|
|
||||||
|
|
||||||
var toString = {}.toString;
|
|
||||||
|
|
||||||
module.exports = Array.isArray || function (arr) {
|
|
||||||
return toString.call(arr) == '[object Array]';
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./node_modules/rxjs/_esm5/index.js":
|
/***/ "./node_modules/rxjs/_esm5/index.js":
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -24,6 +24,12 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
needOpenWallets = [];
|
needOpenWallets = [];
|
||||||
|
|
||||||
|
currenciesFromNet = {
|
||||||
|
ZANO_bitmesh: null,
|
||||||
|
ZANO_qtrade: null,
|
||||||
|
BTC_bitmesh: null
|
||||||
|
};
|
||||||
|
|
||||||
@ViewChild('allContextMenu') public allContextMenu: ContextMenuComponent;
|
@ViewChild('allContextMenu') public allContextMenu: ContextMenuComponent;
|
||||||
@ViewChild('onlyCopyContextMenu') public onlyCopyContextMenu: ContextMenuComponent;
|
@ViewChild('onlyCopyContextMenu') public onlyCopyContextMenu: ContextMenuComponent;
|
||||||
|
|
||||||
|
|
@ -547,18 +553,52 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
this.getMoneyEquivalent();
|
this.getMoneyEquivalent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
recountMoneyEquivalent() {
|
||||||
|
let sum = 0;
|
||||||
|
let count = 0;
|
||||||
|
if (this.currenciesFromNet.BTC_bitmesh) {
|
||||||
|
if (this.currenciesFromNet.ZANO_qtrade) {
|
||||||
|
sum += this.currenciesFromNet.ZANO_qtrade;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if (this.currenciesFromNet.ZANO_bitmesh) {
|
||||||
|
sum += this.currenciesFromNet.ZANO_bitmesh;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.variablesService.moneyEquivalent = (sum / count) / this.currenciesFromNet.BTC_bitmesh;
|
||||||
|
}
|
||||||
|
|
||||||
getMoneyEquivalent() {
|
getMoneyEquivalent() {
|
||||||
this.http.get('https://api.coinmarketcap.com/v2/ticker/406').subscribe(
|
this.http.get('https://blockchain.info/tobtc?currency=USD&value=1').subscribe(
|
||||||
result => {
|
result1 => {
|
||||||
if (result.hasOwnProperty('data')) {
|
this.currenciesFromNet.BTC_bitmesh = result1;
|
||||||
this.variablesService.moneyEquivalent = result['data']['quotes']['USD']['price'];
|
this.http.get('https://api.qtrade.io/v1/ticker/ZANO_BTC').subscribe(
|
||||||
}
|
result2 => {
|
||||||
|
if (result2.hasOwnProperty('data')) {
|
||||||
|
this.currenciesFromNet.ZANO_qtrade = (parseFloat(result2['data']['ask']) + parseFloat(result2['data']['bid'])) / 2;
|
||||||
|
}
|
||||||
|
this.recountMoneyEquivalent();
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.http.get('https://api.bitmesh.com/?api=market.statistics¶ms={"market":"btc_zano"}').subscribe(
|
||||||
|
result3 => {
|
||||||
|
if (result3.hasOwnProperty('data')) {
|
||||||
|
this.currenciesFromNet.ZANO_bitmesh = parseFloat(result3['data']['price']);
|
||||||
|
}
|
||||||
|
this.recountMoneyEquivalent();
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.getMoneyEquivalent();
|
this.getMoneyEquivalent();
|
||||||
}, 60000);
|
}, 60000);
|
||||||
console.warn('Error coinmarketcap', error);
|
console.warn('Error', error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue