blob: d27234af54717ab20c2d342376392b6c2bab9b04 [file] [log] [blame]
{"version":3,"file":"QueueAction.js","sourceRoot":"","sources":["../../src/scheduler/QueueAction.ts"],"names":[],"mappings":";;;;;;AAAA,4BAA4B,eAAe,CAAC,CAAA;AAI5C;;;;GAIG;AACH;IAAoC,+BAAc;IAEhD,qBAAsB,SAAyB,EACzB,IAA+C;QACnE,kBAAM,SAAS,EAAE,IAAI,CAAC,CAAC;QAFH,cAAS,GAAT,SAAS,CAAgB;QACzB,SAAI,GAAJ,IAAI,CAA2C;IAErE,CAAC;IAEM,8BAAQ,GAAf,UAAgB,KAAS,EAAE,KAAiB;QAAjB,qBAAiB,GAAjB,SAAiB;QAC1C,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YACd,MAAM,CAAC,gBAAK,CAAC,QAAQ,YAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAEM,6BAAO,GAAd,UAAe,KAAQ,EAAE,KAAa;QACpC,MAAM,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC;YAC/B,gBAAK,CAAC,OAAO,YAAC,KAAK,EAAE,KAAK,CAAC;YAC3B,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAE;IACjC,CAAC;IAES,oCAAc,GAAxB,UAAyB,SAAyB,EAAE,EAAQ,EAAE,KAAiB;QAAjB,qBAAiB,GAAjB,SAAiB;QAC7E,sEAAsE;QACtE,sEAAsE;QACtE,2CAA2C;QAC3C,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACxE,MAAM,CAAC,gBAAK,CAAC,cAAc,YAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;QACD,2DAA2D;QAC3D,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IACH,kBAAC;AAAD,CAAC,AAjCD,CAAoC,yBAAW,GAiC9C;AAjCY,mBAAW,cAiCvB,CAAA","sourcesContent":["import { AsyncAction } from './AsyncAction';\nimport { Subscription } from '../Subscription';\nimport { QueueScheduler } from './QueueScheduler';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class QueueAction<T> extends AsyncAction<T> {\n\n constructor(protected scheduler: QueueScheduler,\n protected work: (this: QueueAction<T>, state?: T) => void) {\n super(scheduler, work);\n }\n\n public schedule(state?: T, delay: number = 0): Subscription {\n if (delay > 0) {\n return super.schedule(state, delay);\n }\n this.delay = delay;\n this.state = state;\n this.scheduler.flush(this);\n return this;\n }\n\n public execute(state: T, delay: number): any {\n return (delay > 0 || this.closed) ?\n super.execute(state, delay) :\n this._execute(state, delay) ;\n }\n\n protected requestAsyncId(scheduler: QueueScheduler, id?: any, delay: number = 0): any {\n // If delay exists and is greater than 0, or if the delay is null (the\n // action wasn't rescheduled) but was originally scheduled as an async\n // action, then recycle as an async action.\n if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n // Otherwise flush the scheduler starting with this action.\n return scheduler.flush(this);\n }\n}\n"]}