Subtheme of barrio
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
3.5 KiB

2 years ago
{"version":3,"file":"AsapAction.js","sourceRoot":"","sources":["../../src/scheduler/AsapAction.ts"],"names":[],"mappings":";;;;;;AAAA,0BAA0B,mBAAmB,CAAC,CAAA;AAC9C,4BAA4B,eAAe,CAAC,CAAA;AAG5C;;;;GAIG;AACH;IAAmC,8BAAc;IAE/C,oBAAsB,SAAwB,EACxB,IAA8C;QAClE,kBAAM,SAAS,EAAE,IAAI,CAAC,CAAC;QAFH,cAAS,GAAT,SAAS,CAAe;QACxB,SAAI,GAAJ,IAAI,CAA0C;IAEpE,CAAC;IAES,mCAAc,GAAxB,UAAyB,SAAwB,EAAE,EAAQ,EAAE,KAAiB;QAAjB,qBAAiB,GAAjB,SAAiB;QAC5E,0DAA0D;QAC1D,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YAChC,MAAM,CAAC,gBAAK,CAAC,cAAc,YAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;QACD,qDAAqD;QACrD,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,oEAAoE;QACpE,0EAA0E;QAC1E,sCAAsC;QACtC,MAAM,CAAC,SAAS,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,qBAAS,CAAC,YAAY,CACzE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CACtC,CAAC,CAAC;IACL,CAAC;IACS,mCAAc,GAAxB,UAAyB,SAAwB,EAAE,EAAQ,EAAE,KAAiB;QAAjB,qBAAiB,GAAjB,SAAiB;QAC5E,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,sEAAsE;QACtE,2EAA2E;QAC3E,WAAW;QACX,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;YACnC,qBAAS,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;YAC7B,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC;QAClC,CAAC;QACD,sFAAsF;QACtF,MAAM,CAAC,SAAS,CAAC;IACnB,CAAC;IACH,iBAAC;AAAD,CAAC,AAtCD,CAAmC,yBAAW,GAsC7C;AAtCY,kBAAU,aAsCtB,CAAA","sourcesContent":["import { Immediate } from '../util/Immediate';\nimport { AsyncAction } from './AsyncAction';\nimport { AsapScheduler } from './AsapScheduler';\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class AsapAction<T> extends AsyncAction<T> {\n\n constructor(protected scheduler: AsapScheduler,\n protected work: (this: AsapAction<T>, state?: T) => void) {\n super(scheduler, work);\n }\n\n protected requestAsyncId(scheduler: AsapScheduler, id?: any, delay: number = 0): any {\n // If delay is greater than 0, request as an async action.\n if (delay !== null && delay > 0) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n // Push the action to the end of the scheduler queue.\n scheduler.actions.push(this);\n // If a microtask has already been scheduled, don't schedule another\n // one. If a microtask hasn't been scheduled yet, schedule one now. Return\n // the current scheduled microtask id.\n return scheduler.scheduled || (scheduler.scheduled = Immediate.setImmediate(\n scheduler.flush.bind(scheduler, null)\n ));\n }\n protected recycleAsyncId(scheduler: AsapScheduler, 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.recycleAsyncId(scheduler, id, delay);\n }\n // If the scheduler queue is empty, cancel the requested microtask and\n // set the scheduled flag to undefined so the next AsapAction will schedule\n // its own.\n if (scheduler.actions.length === 0) {\n Immediate.clearImmediate(id);\n scheduler.scheduled = undefined;\n }\n // Return undefined so the action knows to request a new async id if it's rescheduled.\n return undefined;\n }\n}\n"]}