forked from lthn/blockchain
change order api requests
This commit is contained in:
parent
029891a792
commit
10e99d8b75
11 changed files with 556 additions and 269 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 */
|
||||
/***/ (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
|
||||
|
||||
|
||||
|
|
@ -1807,7 +1807,7 @@ var store = global[SHARED] || (global[SHARED] = {});
|
|||
})('versions', []).push({
|
||||
version: core.version,
|
||||
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
|
||||
*/
|
||||
var Zone$1 = (function (global) {
|
||||
var FUNCTION = 'function';
|
||||
var performance = global['performance'];
|
||||
function mark(name) {
|
||||
performance && performance['mark'] && performance['mark'](name);
|
||||
|
|
@ -2373,12 +2372,26 @@ var Zone$1 = (function (global) {
|
|||
performance && performance['measure'] && performance['measure'](name, label);
|
||||
}
|
||||
mark('Zone');
|
||||
var checkDuplicate = global[('__zone_symbol__forceDuplicateZoneCheck')] === true;
|
||||
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 () {
|
||||
function Zone(parent, zoneSpec) {
|
||||
this._properties = null;
|
||||
this._parent = parent;
|
||||
this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '<root>';
|
||||
this._properties = zoneSpec && zoneSpec.properties || {};
|
||||
|
|
@ -2421,7 +2434,9 @@ var Zone$1 = (function (global) {
|
|||
});
|
||||
Zone.__load_patch = function (name, fn) {
|
||||
if (patches.hasOwnProperty(name)) {
|
||||
throw Error('Already loaded patch: ' + name);
|
||||
if (checkDuplicate) {
|
||||
throw Error('Already loaded patch: ' + name);
|
||||
}
|
||||
}
|
||||
else if (!global['__Zone_disable_' + name]) {
|
||||
var perfName = 'Zone:' + name;
|
||||
|
|
@ -2465,7 +2480,7 @@ var Zone$1 = (function (global) {
|
|||
return this._zoneDelegate.fork(this, zoneSpec);
|
||||
};
|
||||
Zone.prototype.wrap = function (callback, source) {
|
||||
if (typeof callback !== FUNCTION) {
|
||||
if (typeof callback !== 'function') {
|
||||
throw new Error('Expecting function got: ' + callback);
|
||||
}
|
||||
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) {
|
||||
if (applyThis === void 0) { applyThis = undefined; }
|
||||
if (applyArgs === void 0) { applyArgs = null; }
|
||||
if (source === void 0) { source = null; }
|
||||
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
||||
try {
|
||||
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) {
|
||||
if (applyThis === void 0) { applyThis = null; }
|
||||
if (applyArgs === void 0) { applyArgs = null; }
|
||||
if (source === void 0) { source = null; }
|
||||
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
||||
try {
|
||||
try {
|
||||
|
|
@ -2513,10 +2523,7 @@ var Zone$1 = (function (global) {
|
|||
// https://github.com/angular/zone.js/issues/778, sometimes eventTask
|
||||
// will run in notScheduled(canceled) state, we should not try to
|
||||
// run such kind of task but just return
|
||||
// we have to define an variable here, if not
|
||||
// typescript compiler will complain below
|
||||
var isNotScheduled = task.state === notScheduled;
|
||||
if (isNotScheduled && task.type === eventTask) {
|
||||
if (task.state === notScheduled && (task.type === eventTask || task.type === macroTask)) {
|
||||
return;
|
||||
}
|
||||
var reEntryGuard = task.state != running;
|
||||
|
|
@ -2527,7 +2534,7 @@ var Zone$1 = (function (global) {
|
|||
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
|
||||
try {
|
||||
if (task.type == macroTask && task.data && !task.data.isPeriodic) {
|
||||
task.cancelFn = null;
|
||||
task.cancelFn = undefined;
|
||||
}
|
||||
try {
|
||||
return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
|
||||
|
|
@ -2563,8 +2570,7 @@ var Zone$1 = (function (global) {
|
|||
var newZone = this;
|
||||
while (newZone) {
|
||||
if (newZone === task.zone) {
|
||||
throw Error("can not reschedule task to " + this
|
||||
.name + " which is descendants of the original zone " + task.zone.name);
|
||||
throw Error("can not reschedule task to " + this.name + " which is descendants of the original zone " + task.zone.name);
|
||||
}
|
||||
newZone = newZone.parent;
|
||||
}
|
||||
|
|
@ -2594,7 +2600,7 @@ var Zone$1 = (function (global) {
|
|||
return task;
|
||||
};
|
||||
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) {
|
||||
return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));
|
||||
|
|
@ -2635,16 +2641,14 @@ var Zone$1 = (function (global) {
|
|||
}());
|
||||
var DELEGATE_ZS = {
|
||||
name: '',
|
||||
onHasTask: function (delegate, _, target, hasTaskState) {
|
||||
return delegate.hasTask(target, hasTaskState);
|
||||
},
|
||||
onHasTask: function (delegate, _, target, hasTaskState) { return delegate.hasTask(target, hasTaskState); },
|
||||
onScheduleTask: function (delegate, _, target, task) {
|
||||
return delegate.scheduleTask(target, task);
|
||||
},
|
||||
onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) { return delegate.invokeTask(target, task, applyThis, applyArgs); },
|
||||
onCancelTask: function (delegate, _, target, task) {
|
||||
return delegate.cancelTask(target, task);
|
||||
}
|
||||
onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) {
|
||||
return delegate.invokeTask(target, task, applyThis, applyArgs);
|
||||
},
|
||||
onCancelTask: function (delegate, _, target, task) { return delegate.cancelTask(target, task); }
|
||||
};
|
||||
var ZoneDelegate = /** @class */ (function () {
|
||||
function ZoneDelegate(zone, parentDelegate, zoneSpec) {
|
||||
|
|
@ -2672,8 +2676,8 @@ var Zone$1 = (function (global) {
|
|||
zoneSpec && (zoneSpec.onHandleError ? this.zone : parentDelegate.zone);
|
||||
this._scheduleTaskZS =
|
||||
zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);
|
||||
this._scheduleTaskDlgt =
|
||||
zoneSpec && (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
|
||||
this._scheduleTaskDlgt = zoneSpec &&
|
||||
(zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
|
||||
this._scheduleTaskCurrZone =
|
||||
zoneSpec && (zoneSpec.onScheduleTask ? this.zone : parentDelegate.zone);
|
||||
this._invokeTaskZS =
|
||||
|
|
@ -2728,8 +2732,7 @@ var Zone$1 = (function (global) {
|
|||
callback;
|
||||
};
|
||||
ZoneDelegate.prototype.invoke = function (targetZone, callback, applyThis, applyArgs, source) {
|
||||
return this._invokeZS ?
|
||||
this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :
|
||||
return this._invokeZS ? this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :
|
||||
callback.apply(applyThis, applyArgs);
|
||||
};
|
||||
ZoneDelegate.prototype.handleError = function (targetZone, error) {
|
||||
|
|
@ -2761,8 +2764,7 @@ var Zone$1 = (function (global) {
|
|||
return returnTask;
|
||||
};
|
||||
ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {
|
||||
return this._invokeTaskZS ?
|
||||
this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :
|
||||
return this._invokeTaskZS ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :
|
||||
task.callback.apply(applyThis, applyArgs);
|
||||
};
|
||||
ZoneDelegate.prototype.cancelTask = function (targetZone, task) {
|
||||
|
|
@ -2782,7 +2784,7 @@ var Zone$1 = (function (global) {
|
|||
// hasTask should not throw error so other ZoneDelegate
|
||||
// can still trigger hasTask callback
|
||||
try {
|
||||
return this._hasTaskZS &&
|
||||
this._hasTaskZS &&
|
||||
this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);
|
||||
}
|
||||
catch (err) {
|
||||
|
|
@ -2872,14 +2874,12 @@ var Zone$1 = (function (global) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
throw new Error(this.type + " '" + this.source + "': can not transition to '" + toState + "', expecting state '" + fromState1 + "'" + (fromState2 ?
|
||||
' or \'' + fromState2 + '\'' :
|
||||
'') + ", was '" + this._state + "'.");
|
||||
throw new Error(this.type + " '" + this.source + "': can not transition to '" + toState + "', expecting state '" + fromState1 + "'" + (fromState2 ? ' or \'' + fromState2 + '\'' : '') + ", was '" + this._state + "'.");
|
||||
}
|
||||
};
|
||||
ZoneTask.prototype.toString = function () {
|
||||
if (this.data && typeof this.data.handleId !== 'undefined') {
|
||||
return this.data.handleId;
|
||||
return this.data.handleId.toString();
|
||||
}
|
||||
else {
|
||||
return Object.prototype.toString.call(this);
|
||||
|
|
@ -2920,7 +2920,13 @@ var Zone$1 = (function (global) {
|
|||
}
|
||||
}
|
||||
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 {
|
||||
global[symbolSetTimeout](drainMicroTaskQueue, 0);
|
||||
|
|
@ -2967,12 +2973,13 @@ var Zone$1 = (function (global) {
|
|||
patchEventTarget: function () { return []; },
|
||||
patchOnProperties: noop,
|
||||
patchMethod: function () { return noop; },
|
||||
bindArguments: function () { return null; },
|
||||
bindArguments: function () { return []; },
|
||||
patchThen: function () { return noop; },
|
||||
setNativePromise: function (NativePromise) {
|
||||
// sometimes NativePromise.resolve static function
|
||||
// is not ready yet, (such as core-js/es6.promise)
|
||||
// so we need to check here.
|
||||
if (NativePromise && typeof NativePromise.resolve === FUNCTION) {
|
||||
if (NativePromise && typeof NativePromise.resolve === 'function') {
|
||||
nativeMicroTaskQueuePromise = NativePromise.resolve(0);
|
||||
}
|
||||
},
|
||||
|
|
@ -2988,6 +2995,16 @@ var Zone$1 = (function (global) {
|
|||
return global['Zone'] = Zone;
|
||||
})(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) {
|
||||
var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
var ObjectDefineProperty = Object.defineProperty;
|
||||
|
|
@ -3130,7 +3147,7 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
|||
var queue = promise[symbolValue];
|
||||
promise[symbolValue] = value;
|
||||
if (promise[symbolFinally] === symbolFinally) {
|
||||
// the promise is generated by Promise.prototype.finally
|
||||
// the promise is generated by Promise.prototype.finally
|
||||
if (state === RESOLVED) {
|
||||
// the state is resolved, should ignore the value
|
||||
// and use parent promise value
|
||||
|
|
@ -3214,7 +3231,9 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
|||
chainPromise[symbolParentPromiseState] = promiseState;
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
catch (error) {
|
||||
|
|
@ -3249,6 +3268,7 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
|||
return resolvePromise(new this(null), REJECTED, error);
|
||||
};
|
||||
ZoneAwarePromise.race = function (values) {
|
||||
var e_1, _a;
|
||||
var resolve;
|
||||
var reject;
|
||||
var promise = new this(function (res, rej) {
|
||||
|
|
@ -3261,40 +3281,70 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
|||
function onReject(error) {
|
||||
promise && (promise = false || reject(error));
|
||||
}
|
||||
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
|
||||
var value = values_1[_i];
|
||||
if (!isThenable(value)) {
|
||||
value = this.resolve(value);
|
||||
try {
|
||||
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
||||
var value = values_1_1.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;
|
||||
};
|
||||
ZoneAwarePromise.all = function (values) {
|
||||
var e_2, _a;
|
||||
var resolve;
|
||||
var reject;
|
||||
var promise = new this(function (res, rej) {
|
||||
resolve = res;
|
||||
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 = [];
|
||||
for (var _i = 0, values_2 = values; _i < values_2.length; _i++) {
|
||||
var value = values_2[_i];
|
||||
var _loop_2 = function (value) {
|
||||
if (!isThenable(value)) {
|
||||
value = this.resolve(value);
|
||||
value = this_1.resolve(value);
|
||||
}
|
||||
value.then((function (index) { return function (value) {
|
||||
resolvedValues[index] = value;
|
||||
count--;
|
||||
if (!count) {
|
||||
var curValueIndex = valueIndex;
|
||||
value.then(function (value) {
|
||||
resolvedValues[curValueIndex] = value;
|
||||
unresolvedCount--;
|
||||
if (unresolvedCount === 0) {
|
||||
resolve(resolvedValues);
|
||||
}
|
||||
}; })(count), reject);
|
||||
count++;
|
||||
}, reject);
|
||||
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);
|
||||
}
|
||||
return promise;
|
||||
};
|
||||
ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) {
|
||||
|
|
@ -3390,31 +3440,112 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
|
|||
};
|
||||
Ctor[symbolThenPatched] = true;
|
||||
}
|
||||
function zoneify(fn) {
|
||||
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;
|
||||
};
|
||||
}
|
||||
api.patchThen = patchThen;
|
||||
if (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.
|
||||
Promise[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors;
|
||||
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
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
|
|
@ -3530,9 +3661,23 @@ var wrapFn = function (event) {
|
|||
}
|
||||
var target = this || event.target || _global;
|
||||
var listener = target[eventNameSymbol];
|
||||
var result = listener && listener.apply(this, arguments);
|
||||
if (result != undefined && !result) {
|
||||
event.preventDefault();
|
||||
var result;
|
||||
if (isBrowser && target === internalWindow && event.type === 'error') {
|
||||
// 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;
|
||||
};
|
||||
|
|
@ -3550,6 +3695,10 @@ function patchProperty(obj, prop, prototype) {
|
|||
if (!desc || !desc.configurable) {
|
||||
return;
|
||||
}
|
||||
var onPropPatchedSymbol = zoneSymbol('on' + prop + 'patched');
|
||||
if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) {
|
||||
return;
|
||||
}
|
||||
// A property descriptor cannot have getter/setter and be writable
|
||||
// deleting the writable and value properties avoids this error:
|
||||
//
|
||||
|
|
@ -3627,6 +3776,7 @@ function patchProperty(obj, prop, prototype) {
|
|||
return null;
|
||||
};
|
||||
ObjectDefineProperty(obj, prop, desc);
|
||||
obj[onPropPatchedSymbol] = true;
|
||||
}
|
||||
function patchOnProperties(obj, properties, prototype) {
|
||||
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) {
|
||||
var proto = target;
|
||||
while (proto && !proto.hasOwnProperty(name)) {
|
||||
|
|
@ -3727,7 +3902,7 @@ function patchMethod(target, name, patchFn) {
|
|||
proto = target;
|
||||
}
|
||||
var delegateName = zoneSymbol(name);
|
||||
var delegate;
|
||||
var delegate = null;
|
||||
if (proto && !(delegate = proto[delegateName])) {
|
||||
delegate = proto[delegateName] = proto[name];
|
||||
// check whether proto[name] is writable
|
||||
|
|
@ -3739,6 +3914,9 @@ function patchMethod(target, name, patchFn) {
|
|||
return patchDelegate_1(this, arguments);
|
||||
};
|
||||
attachOriginToPatched(proto[name], delegate);
|
||||
if (shouldCopySymbolProperties) {
|
||||
copySymbolProperties(delegate, proto[name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return delegate;
|
||||
|
|
@ -3757,7 +3935,7 @@ function patchMacroTask(obj, funcName, metaCreator) {
|
|||
setNative = patchMethod(obj, funcName, function (delegate) { return function (self, args) {
|
||||
var meta = metaCreator(self, args);
|
||||
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 {
|
||||
// cause an error by calling it directly.
|
||||
|
|
@ -3771,6 +3949,17 @@ function attachOriginToPatched(patched, original) {
|
|||
}
|
||||
var isDetectedIEOrEdge = 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() {
|
||||
if (isDetectedIEOrEdge) {
|
||||
return ieOrEdge;
|
||||
|
|
@ -3852,6 +4041,21 @@ Zone.__load_patch('toString', function (global) {
|
|||
* @fileoverview
|
||||
* @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
|
||||
var OPTIMIZED_ZONE_EVENT_TASK_DATA = {
|
||||
useG: true
|
||||
|
|
@ -3987,6 +4191,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
if (proto[zoneSymbolAddEventListener]) {
|
||||
return false;
|
||||
}
|
||||
var eventNameToString = patchOptions && patchOptions.eventNameToString;
|
||||
// a shared global taskData to pass data for scheduleEventTask
|
||||
// so we do not need to create a new object just for pass some data
|
||||
var taskData = {};
|
||||
|
|
@ -4002,12 +4207,24 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
nativePrependEventListener = proto[zoneSymbol(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,
|
||||
// just return, because we use the shared globalZoneAwareCallback here.
|
||||
if (taskData.isExisting) {
|
||||
return;
|
||||
}
|
||||
checkIsPassive(task);
|
||||
return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options);
|
||||
};
|
||||
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);
|
||||
};
|
||||
var customScheduleNonGlobal = function (task) {
|
||||
checkIsPassive(task);
|
||||
return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);
|
||||
};
|
||||
var customSchedulePrepend = function (task) {
|
||||
|
|
@ -4070,10 +4288,15 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
if (prepend === void 0) { prepend = false; }
|
||||
return function () {
|
||||
var target = this || _global;
|
||||
var eventName = arguments[0];
|
||||
var delegate = arguments[1];
|
||||
if (!delegate) {
|
||||
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
|
||||
// case here to improve addEventListener performance
|
||||
// we will create the bind delegate when invoke
|
||||
|
|
@ -4087,7 +4310,6 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) {
|
||||
return;
|
||||
}
|
||||
var eventName = arguments[0];
|
||||
var options = arguments[2];
|
||||
if (blackListedEvents) {
|
||||
// check black list
|
||||
|
|
@ -4117,8 +4339,8 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
var symbolEventName;
|
||||
if (!symbolEventNames) {
|
||||
// the code is duplicate, but I just want to get some better performance
|
||||
var falseEventName = eventName + FALSE_STR;
|
||||
var trueEventName = eventName + TRUE_STR;
|
||||
var falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR;
|
||||
var trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR;
|
||||
var symbol = ZONE_SYMBOL_PREFIX + falseEventName;
|
||||
var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
|
||||
zoneSymbolEventNames$1[eventName] = {};
|
||||
|
|
@ -4153,7 +4375,8 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
source = targetSource[eventName];
|
||||
}
|
||||
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
|
||||
// just use the global shared one
|
||||
|
|
@ -4168,7 +4391,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
taskData.capture = capture;
|
||||
taskData.eventName = eventName;
|
||||
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
|
||||
if (data) {
|
||||
data.taskData = taskData;
|
||||
|
|
@ -4186,7 +4409,11 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
if (once) {
|
||||
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.capture = capture;
|
||||
task.eventName = eventName;
|
||||
|
|
@ -4271,7 +4498,7 @@ function patchEventTarget(_global, apis, patchOptions) {
|
|||
var target = this || _global;
|
||||
var eventName = arguments[0];
|
||||
var listeners = [];
|
||||
var tasks = findEventTasks(target, eventName);
|
||||
var tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName);
|
||||
for (var i = 0; i < tasks.length; i++) {
|
||||
var task = tasks[i];
|
||||
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) {
|
||||
if (typeof args[0] === 'function') {
|
||||
var options = {
|
||||
handleId: null,
|
||||
isPeriodic: nameSuffix === 'Interval',
|
||||
delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 : null,
|
||||
delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 :
|
||||
undefined,
|
||||
args: args
|
||||
};
|
||||
var task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask);
|
||||
|
|
@ -4544,7 +4771,7 @@ function propertyPatch() {
|
|||
};
|
||||
Object.getOwnPropertyDescriptor = function (obj, prop) {
|
||||
var desc = _getOwnPropertyDescriptor(obj, prop);
|
||||
if (isUnconfigurable(obj, prop)) {
|
||||
if (desc && isUnconfigurable(obj, prop)) {
|
||||
desc.configurable = false;
|
||||
}
|
||||
return desc;
|
||||
|
|
@ -4772,10 +4999,10 @@ var globalEventHandlersEventNames = [
|
|||
'wheel'
|
||||
];
|
||||
var documentEventNames = [
|
||||
'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'fullscreenchange',
|
||||
'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'freeze', 'fullscreenchange',
|
||||
'mozfullscreenchange', 'webkitfullscreenchange', 'msfullscreenchange', 'fullscreenerror',
|
||||
'mozfullscreenerror', 'webkitfullscreenerror', 'msfullscreenerror', 'readystatechange',
|
||||
'visibilitychange'
|
||||
'visibilitychange', 'resume'
|
||||
];
|
||||
var windowEventNames = [
|
||||
'absolutedeviceorientation',
|
||||
|
|
@ -4887,7 +5114,7 @@ var websocketEventNames = ['close', 'error', 'open', 'message'];
|
|||
var workerEventNames = ['error', 'message'];
|
||||
var eventNames = globalEventHandlersEventNames.concat(webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames, htmlElementEventNames, ieElementEventNames);
|
||||
function filterProperties(target, onProperties, ignoreProperties) {
|
||||
if (!ignoreProperties) {
|
||||
if (!ignoreProperties || ignoreProperties.length === 0) {
|
||||
return onProperties;
|
||||
}
|
||||
var tip = ignoreProperties.filter(function (ip) { return ip.target === target; });
|
||||
|
|
@ -4912,13 +5139,14 @@ function propertyDescriptorPatch(api, _global) {
|
|||
}
|
||||
var supportsWebSocket = typeof WebSocket !== 'undefined';
|
||||
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
|
||||
if (isBrowser) {
|
||||
var internalWindow = window;
|
||||
var ignoreErrorProperties = isIE ? [{ target: internalWindow, ignoreProperties: ['error'] }] : [];
|
||||
// in IE/Edge, onProp not exist in window object, but in WindowPrototype
|
||||
// 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);
|
||||
if (typeof internalWindow['SVGElement'] !== 'undefined') {
|
||||
patchFilteredProperties(internalWindow['SVGElement'].prototype, eventNames, ignoreProperties);
|
||||
|
|
@ -4940,9 +5168,9 @@ function propertyDescriptorPatch(api, _global) {
|
|||
}
|
||||
}
|
||||
patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties);
|
||||
var XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget'];
|
||||
if (XMLHttpRequestEventTarget) {
|
||||
patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties);
|
||||
var XMLHttpRequestEventTarget_1 = _global['XMLHttpRequestEventTarget'];
|
||||
if (XMLHttpRequestEventTarget_1) {
|
||||
patchFilteredProperties(XMLHttpRequestEventTarget_1 && XMLHttpRequestEventTarget_1.prototype, XMLHttpRequestEventNames, ignoreProperties);
|
||||
}
|
||||
if (typeof IDBIndex !== 'undefined') {
|
||||
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
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
function registerElementPatch(_global) {
|
||||
if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) {
|
||||
function patchCallbacks(target, targetName, method, callbacks) {
|
||||
var symbol = Zone.__symbol__(method);
|
||||
if (target[symbol]) {
|
||||
return;
|
||||
}
|
||||
var _registerElement = document.registerElement;
|
||||
var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback'];
|
||||
document.registerElement = function (name, opts) {
|
||||
var nativeDelegate = target[symbol] = target[method];
|
||||
target[method] = function (name, opts, options) {
|
||||
if (opts && opts.prototype) {
|
||||
callbacks.forEach(function (callback) {
|
||||
var source = 'Document.registerElement::' + callback;
|
||||
var source = targetName + "." + method + "::" + callback;
|
||||
var prototype = opts.prototype;
|
||||
if (prototype.hasOwnProperty(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) {
|
||||
propertyDescriptorPatch(api, global);
|
||||
propertyPatch();
|
||||
});
|
||||
Zone.__load_patch('customElements', function (global, Zone, api) {
|
||||
registerElementPatch(global);
|
||||
patchCustomElements(global);
|
||||
});
|
||||
Zone.__load_patch('canvas', function (global) {
|
||||
var HTMLCanvasElement = global['HTMLCanvasElement'];
|
||||
|
|
@ -5267,6 +5512,7 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
var XHR_LISTENER = zoneSymbol('xhrListener');
|
||||
var XHR_SCHEDULED = zoneSymbol('xhrScheduled');
|
||||
var XHR_URL = zoneSymbol('xhrURL');
|
||||
var XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled');
|
||||
function patchXHR(window) {
|
||||
var XMLHttpRequestPrototype = XMLHttpRequest.prototype;
|
||||
function findPendingTask(target) {
|
||||
|
|
@ -5275,9 +5521,9 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
var oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
|
||||
var oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
|
||||
if (!oriAddListener) {
|
||||
var XMLHttpRequestEventTarget = window['XMLHttpRequestEventTarget'];
|
||||
if (XMLHttpRequestEventTarget) {
|
||||
var XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget.prototype;
|
||||
var XMLHttpRequestEventTarget_1 = window['XMLHttpRequestEventTarget'];
|
||||
if (XMLHttpRequestEventTarget_1) {
|
||||
var XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget_1.prototype;
|
||||
oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_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 SCHEDULED = 'scheduled';
|
||||
function scheduleTask(task) {
|
||||
XMLHttpRequest[XHR_SCHEDULED] = false;
|
||||
var data = task.data;
|
||||
var target = data.target;
|
||||
target[XHR_SCHEDULED] = false;
|
||||
target[XHR_ERROR_BEFORE_SCHEDULED] = false;
|
||||
// remove existing event listener
|
||||
var listener = target[XHR_LISTENER];
|
||||
if (!oriAddListener) {
|
||||
|
|
@ -5301,8 +5548,35 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
if (target.readyState === target.DONE) {
|
||||
// sometimes on some browsers XMLHttpRequest will fire onreadystatechange with
|
||||
// readyState=4 multiple times, so we need to check task state here
|
||||
if (!data.aborted && XMLHttpRequest[XHR_SCHEDULED] && task.state === SCHEDULED) {
|
||||
task.invoke();
|
||||
if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) {
|
||||
// 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;
|
||||
}
|
||||
sendNative.apply(target, data.args);
|
||||
XMLHttpRequest[XHR_SCHEDULED] = true;
|
||||
target[XHR_SCHEDULED] = true;
|
||||
return task;
|
||||
}
|
||||
function placeholderCallback() { }
|
||||
|
|
@ -5329,24 +5603,32 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
return openNative.apply(self, args);
|
||||
}; });
|
||||
var XMLHTTPREQUEST_SOURCE = 'XMLHttpRequest.send';
|
||||
var fetchTaskAborting = zoneSymbol('fetchTaskAborting');
|
||||
var fetchTaskScheduling = zoneSymbol('fetchTaskScheduling');
|
||||
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 the XHR is sync there is no task to schedule, just execute the code.
|
||||
return sendNative.apply(self, args);
|
||||
}
|
||||
else {
|
||||
var options = {
|
||||
target: self,
|
||||
url: self[XHR_URL],
|
||||
isPeriodic: false,
|
||||
delay: null,
|
||||
args: args,
|
||||
aborted: false
|
||||
};
|
||||
return scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);
|
||||
var options = { target: self, url: self[XHR_URL], isPeriodic: false, args: args, aborted: false };
|
||||
var task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);
|
||||
if (self && self[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted &&
|
||||
task.state === SCHEDULED) {
|
||||
// xhr request throw error when send
|
||||
// we should invoke task instead of leaving a scheduled
|
||||
// pending macroTask
|
||||
task.invoke();
|
||||
}
|
||||
}
|
||||
}; });
|
||||
var abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', function () { return function (self) {
|
||||
var abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', function () { return function (self, args) {
|
||||
var task = findPendingTask(self);
|
||||
if (task && typeof task.type == 'string') {
|
||||
// If the XHR has already completed, do nothing.
|
||||
|
|
@ -5358,6 +5640,10 @@ Zone.__load_patch('XHR', function (global, Zone) {
|
|||
}
|
||||
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
|
||||
// task
|
||||
// to cancel. Do nothing.
|
||||
|
|
@ -5497,8 +5783,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
__webpack_require__(/*! D:\Projects\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");
|
||||
__webpack_require__(/*! D:\zano_zano\src\gui\qt-daemon\html_source\src\polyfills.ts */"./src/polyfills.ts");
|
||||
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
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./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":
|
||||
|
|
@ -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 EXP_TABLE = new Buffer(512)
|
||||
var LOG_TABLE = new Buffer(256)
|
||||
|
||||
if(Buffer.alloc) {
|
||||
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
|
||||
*
|
||||
|
|
@ -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 Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.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
|
||||
|
|
@ -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 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 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
|
||||
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 () {
|
||||
// Can typed array instances be augmented?
|
||||
|
|
@ -101569,22 +101589,6 @@ Buffer.isBuffer = function isBuffer (b) {
|
|||
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":
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -119,7 +119,7 @@ export class Wallet {
|
|||
}
|
||||
}
|
||||
if (!exists) {
|
||||
if (this.history.length && items[i].timestamp > this.history[0].timestamp) {
|
||||
if (this.history.length && items[i].timestamp >= this.history[0].timestamp) {
|
||||
this.history.unshift(this.prepareHistoryItem(items[i]));
|
||||
} else {
|
||||
this.history.push(this.prepareHistoryItem(items[i]));
|
||||
|
|
|
|||
|
|
@ -81,45 +81,43 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||
this.backend.openWallet(wallet.path, wallet.pass, true, (open_status, open_data) => {
|
||||
if (open_status) {
|
||||
openWallets++;
|
||||
this.ngZone.run(() => {
|
||||
const new_wallet = new Wallet(
|
||||
open_data.wallet_id,
|
||||
wallet.name,
|
||||
wallet.pass,
|
||||
open_data['wi'].path,
|
||||
open_data['wi'].address,
|
||||
open_data['wi'].balance,
|
||||
open_data['wi'].unlocked_balance,
|
||||
open_data['wi'].mined_total,
|
||||
open_data['wi'].tracking_hey
|
||||
);
|
||||
new_wallet.alias = this.backend.getWalletAlias(new_wallet.address);
|
||||
if (open_data.recent_history && open_data.recent_history.history) {
|
||||
new_wallet.prepareHistory(open_data.recent_history.history);
|
||||
}
|
||||
this.backend.getContracts(open_data.wallet_id, (contracts_status, contracts_data) => {
|
||||
if (contracts_status && contracts_data.hasOwnProperty('contracts')) {
|
||||
this.ngZone.run(() => {
|
||||
new_wallet.prepareContractsAfterOpen(contracts_data.contracts, this.variablesService.exp_med_ts, this.variablesService.height_app, this.variablesService.settings.viewedContracts, this.variablesService.settings.notViewedContracts);
|
||||
});
|
||||
}
|
||||
});
|
||||
this.variablesService.wallets.push(new_wallet);
|
||||
if (this.variablesService.wallets.length === 1) {
|
||||
this.router.navigate(['/wallet/' + this.variablesService.wallets[0].wallet_id]);
|
||||
}
|
||||
});
|
||||
this.backend.runWallet(open_data.wallet_id, (run_status) => {
|
||||
if (run_status) {
|
||||
runWallets++;
|
||||
this.ngZone.run(() => {
|
||||
const new_wallet = new Wallet(
|
||||
open_data.wallet_id,
|
||||
wallet.name,
|
||||
wallet.pass,
|
||||
open_data['wi'].path,
|
||||
open_data['wi'].address,
|
||||
open_data['wi'].balance,
|
||||
open_data['wi'].unlocked_balance,
|
||||
open_data['wi'].mined_total,
|
||||
open_data['wi'].tracking_hey
|
||||
);
|
||||
new_wallet.alias = this.backend.getWalletAlias(new_wallet.address);
|
||||
if (open_data.recent_history && open_data.recent_history.history) {
|
||||
new_wallet.prepareHistory(open_data.recent_history.history);
|
||||
}
|
||||
this.backend.getContracts(open_data.wallet_id, (contracts_status, contracts_data) => {
|
||||
if (contracts_status && contracts_data.hasOwnProperty('contracts')) {
|
||||
this.ngZone.run(() => {
|
||||
new_wallet.prepareContractsAfterOpen(contracts_data.contracts, this.variablesService.exp_med_ts, this.variablesService.height_app, this.variablesService.settings.viewedContracts, this.variablesService.settings.notViewedContracts);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.variablesService.wallets.push(new_wallet);
|
||||
if (this.variablesService.wallets.length === 1) {
|
||||
this.router.navigate(['/wallet/' + this.variablesService.wallets[0].wallet_id]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (wallet_index === data.length - 1 && runWallets === 0) {
|
||||
this.ngZone.run(() => {
|
||||
this.router.navigate(['/']);
|
||||
});
|
||||
}
|
||||
// console.log(run_data['error_code']);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -85,31 +85,31 @@ export class OpenWalletComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
});
|
||||
} else {
|
||||
const new_wallet = new Wallet(
|
||||
open_data.wallet_id,
|
||||
this.openForm.get('name').value,
|
||||
this.openForm.get('password').value,
|
||||
open_data['wi'].path,
|
||||
open_data['wi'].address,
|
||||
open_data['wi'].balance,
|
||||
open_data['wi'].unlocked_balance,
|
||||
open_data['wi'].mined_total,
|
||||
open_data['wi'].tracking_hey
|
||||
);
|
||||
new_wallet.alias = this.backend.getWalletAlias(new_wallet.address);
|
||||
if (open_data.recent_history && open_data.recent_history.history) {
|
||||
new_wallet.prepareHistory(open_data.recent_history.history);
|
||||
}
|
||||
this.backend.getContracts(open_data.wallet_id, (contracts_status, contracts_data) => {
|
||||
if (contracts_status && contracts_data.hasOwnProperty('contracts')) {
|
||||
this.ngZone.run(() => {
|
||||
new_wallet.prepareContractsAfterOpen(contracts_data.contracts, this.variablesService.exp_med_ts, this.variablesService.height_app, this.variablesService.settings.viewedContracts, this.variablesService.settings.notViewedContracts);
|
||||
});
|
||||
}
|
||||
});
|
||||
this.variablesService.wallets.push(new_wallet);
|
||||
this.backend.runWallet(open_data.wallet_id, (run_status, run_data) => {
|
||||
if (run_status) {
|
||||
const new_wallet = new Wallet(
|
||||
open_data.wallet_id,
|
||||
this.openForm.get('name').value,
|
||||
this.openForm.get('password').value,
|
||||
open_data['wi'].path,
|
||||
open_data['wi'].address,
|
||||
open_data['wi'].balance,
|
||||
open_data['wi'].unlocked_balance,
|
||||
open_data['wi'].mined_total,
|
||||
open_data['wi'].tracking_hey
|
||||
);
|
||||
new_wallet.alias = this.backend.getWalletAlias(new_wallet.address);
|
||||
if (open_data.recent_history && open_data.recent_history.history) {
|
||||
new_wallet.prepareHistory(open_data.recent_history.history);
|
||||
}
|
||||
this.backend.getContracts(open_data.wallet_id, (contracts_status, contracts_data) => {
|
||||
if (contracts_status && contracts_data.hasOwnProperty('contracts')) {
|
||||
this.ngZone.run(() => {
|
||||
new_wallet.prepareContractsAfterOpen(contracts_data.contracts, this.variablesService.exp_med_ts, this.variablesService.height_app, this.variablesService.settings.viewedContracts, this.variablesService.settings.notViewedContracts);
|
||||
});
|
||||
}
|
||||
});
|
||||
this.variablesService.wallets.push(new_wallet);
|
||||
this.backend.storeSecureAppData((status, data) => {
|
||||
console.log('Store App Data', status, data);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue