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
2.1 KiB
1 line
2.1 KiB
2 years ago
|
{"version":3,"file":"AsyncScheduler.js","sourceRoot":"","sources":["../../src/scheduler/AsyncScheduler.ts"],"names":[],"mappings":";;;;;;AAAA,0BAA0B,cAAc,CAAC,CAAA;AAGzC;IAAoC,kCAAS;IAA7C;QAAoC,8BAAS;QACpC,YAAO,GAA4B,EAAE,CAAC;QAC7C;;;;WAIG;QACI,WAAM,GAAY,KAAK,CAAC;QAC/B;;;;;WAKG;QACI,cAAS,GAAQ,SAAS,CAAC;IA6BpC,CAAC;IA3BQ,8BAAK,GAAZ,UAAa,MAAwB;QAE5B,0BAAO,CAAS;QAEvB,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,MAAM,CAAC;QACT,CAAC;QAED,IAAI,KAAU,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,GAAG,CAAC;YACF,EAAE,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACvD,KAAK,CAAC;YACR,CAAC;QACH,CAAC,QAAQ,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,8BAA8B;QAElE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YACV,OAAO,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;gBAChC,MAAM,CAAC,WAAW,EAAE,CAAC;YACvB,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IACH,qBAAC;AAAD,CAAC,AA3CD,CAAoC,qBAAS,GA2C5C;AA3CY,sBAAc,iBA2C1B,CAAA","sourcesContent":["import { Scheduler } from '../Scheduler';\nimport { AsyncAction } from './AsyncAction';\n\nexport class AsyncScheduler extends Scheduler {\n public actions: Array<AsyncAction<any>> = [];\n /**\n * A flag to indicate whether the Scheduler is currently executing a batch of\n * queued actions.\n * @type {boolean}\n */\n public active: boolean = false;\n /**\n * An internal ID used to track the latest asynchronous task such as those\n * coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and\n * others.\n * @type {any}\n */\n public scheduled: any = undefined;\n\n public flush(action: AsyncAction<any>): void {\n\n const {actions} = this;\n\n if (this.active) {\n actions.push(action);\n return;\n }\n\n let error: any;\n this.active = true;\n\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while (action = actions.shift()); // exhaust the scheduler queue\n\n this.active = false;\n\n if (error) {\n while (action = actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n"]}
|