projecte_ionic/node_modules/zone.js/fesm2015/fake-async-test.min.js

13 lines
11 KiB
JavaScript
Raw Normal View History

2022-02-09 18:30:03 +01:00
"use strict";
/**
* @license Angular v12.0.0-next.0
* (c) 2010-2020 Google LLC. https://angular.io/
* License: MIT
*/
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/!function(e){const t=e.Date;function s(){if(0===arguments.length){const e=new t;return e.setTime(s.now()),e}{const e=Array.prototype.slice.call(arguments);return new t(...e)}}s.now=function(){const e=Zone.current.get("FakeAsyncTestZoneSpec");return e?e.getFakeSystemTime():t.now.apply(this,arguments)},s.UTC=t.UTC,s.parse=t.parse;const r={setTimeout:e.setTimeout,setInterval:e.setInterval,clearTimeout:e.clearTimeout,clearInterval:e.clearInterval};class i{constructor(){this._schedulerQueue=[],this._currentTickTime=0,this._currentFakeBaseSystemTime=t.now(),this._currentTickRequeuePeriodicEntries=[]}getCurrentTickTime(){return this._currentTickTime}getFakeSystemTime(){return this._currentFakeBaseSystemTime+this._currentTickTime}setFakeBaseSystemTime(e){this._currentFakeBaseSystemTime=e}getRealSystemTime(){return t.now()}scheduleFunction(e,t,s){let r=(s=Object.assign({args:[],isPeriodic:!1,isRequestAnimationFrame:!1,id:-1,isRequeuePeriodic:!1},s)).id<0?i.nextId++:s.id,n={endTime:this._currentTickTime+t,id:r,func:e,args:s.args,delay:t,isPeriodic:s.isPeriodic,isRequestAnimationFrame:s.isRequestAnimationFrame};s.isRequeuePeriodic&&this._currentTickRequeuePeriodicEntries.push(n);let c=0;for(;c<this._schedulerQueue.length&&!(n.endTime<this._schedulerQueue[c].endTime);c++);return this._schedulerQueue.splice(c,0,n),r}removeScheduledFunctionWithId(e){for(let t=0;t<this._schedulerQueue.length;t++)if(this._schedulerQueue[t].id==e){this._schedulerQueue.splice(t,1);break}}removeAll(){this._schedulerQueue=[]}getTimerCount(){return this._schedulerQueue.length}tickToNext(e=1,t,s){this._schedulerQueue.length<e||this.tick(this._schedulerQueue[e-1].endTime-this._currentTickTime,t,s)}tick(t=0,s,r){let i=this._currentTickTime+t,n=0;const c=(r=Object.assign({processNewMacroTasksSynchronously:!0},r)).processNewMacroTasksSynchronously?this._schedulerQueue:this._schedulerQueue.slice();if(0===c.length&&s)s(t);else{for(;c.length>0&&(this._currentTickRequeuePeriodicEntries=[],!(i<c[0].endTime));){let t=c.shift();if(!r.processNewMacroTasksSynchronously){const e=this._schedulerQueue.indexOf(t);e>=0&&this._schedulerQueue.splice(e,1)}if(n=this._currentTickTime,this._currentTickTime=t.endTime,s&&s(this._currentTickTime-n),!t.func.apply(e,t.isRequestAnimationFrame?[this._currentTickTime]:t.args))break;r.processNewMacroTasksSynchronously||this._currentTickRequeuePeriodicEntries.forEach(e=>{let t=0;for(;t<c.length&&!(e.endTime<c[t].endTime);t++);c.splice(t,0,e)})}n=this._currentTickTime,this._currentTickTime=i,s&&s(this._currentTickTime-n)}}flushOnlyPendingTimers(e){if(0===this._schedulerQueue.length)return 0;const t=this._currentTickTime;return this.tick(this._schedulerQueue[this._schedulerQueue.length-1].endTime-t,e,{processNewMacroTasksSynchronously:!1}),this._currentTickTime-t}flush(e=20,t=!1,s){return t?this.flushPeriodic(s):this.flushNonPeriodic(e,s)}flushPeriodic(e){if(0===this._schedulerQueue.length)return 0;const t=this._currentTickTime;return this.tick(this._schedulerQueue[this._schedulerQueue.length-1].endTime-t,e),this._currentTickTime-t}flushNonPeriodic(t,s){const r=this._currentTickTime;let i=0,n=0;for(;this._schedulerQueue.length>0;){if(n++,n>t)throw new Error("flush failed after reaching the limit of "+t+" tasks. Does your code use a polling timeout?");if(0===this._schedulerQueue.filter(e=>!e.isPeriodic&&!e.isRequestAnimationFrame).length)break;const r=this._schedulerQueue.shift();if(i=this._currentTickTime,this._currentTickTime=r.endTime,s&&s(this._currentTickTime-i),!r.func.apply(e,r.args))break}return this._currentTickTime-r}}i.nextId=1;class n{constructor(t,s=!1,r){this.trackPendingRequestAnimationFrame=s,this.macroTaskOptions=r,this._scheduler=new i,this._microtasks=[],this._lastError=null,this._uncaughtPromiseErrors=Promise[Zone.__symbol__("uncaughtPromiseErrors")],this.pendingPeriodicTimers=[],this.pendingTimers=[],this.patchDateLocked=!1,this.properties={FakeAsyncTestZoneSpec:this},this.name="fakeAsyncTestZone for "+t,this.macroTaskOptions||(this.macroTaskOptions=e[Zone.__symbol__("FakeAsyncTestMacroTask")])}static assertInZone(){if(n