work.suroh.tk/node_modules/rxjs/scheduler/VirtualTimeScheduler.js.map

1 line
6.1 KiB
Plaintext

{"version":3,"file":"VirtualTimeScheduler.js","sourceRoot":"","sources":["../../src/scheduler/VirtualTimeScheduler.ts"],"names":[],"mappings":";;;;;;AAAA,4BAA4B,eAAe,CAAC,CAAA;AAE5C,+BAA+B,kBAAkB,CAAC,CAAA;AAElD;IAA0C,wCAAc;IAOtD,8BAAY,eAAmD,EAC5C,SAA4C;QARjE,iBAmCC;QA5Ba,+BAAmD,GAAnD,+BAAmD;QACnD,yBAAmD,GAAnD,YAA2B,MAAM,CAAC,iBAAiB;QAC7D,kBAAM,eAAe,EAAE,cAAM,OAAA,KAAI,CAAC,KAAK,EAAV,CAAU,CAAC,CAAC;QADxB,cAAS,GAAT,SAAS,CAAmC;QAJxD,UAAK,GAAW,CAAC,CAAC;QAClB,UAAK,GAAW,CAAC,CAAC,CAAC;IAK1B,CAAC;IAED;;;;OAIG;IACI,oCAAK,GAAZ;QAEE,IAAA,SAAiC,EAA1B,oBAAO,EAAE,wBAAS,CAAS;QAClC,IAAI,KAAU,EAAE,MAAwB,CAAC;QAEzC,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC;YAC9E,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;QAED,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;IAhCgB,oCAAe,G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1DD,CAAsC,yBAAW,GA0DhD;AA1DY,qBAAa,gBA0DzB,CAAA","sourcesContent":["import { AsyncAction } from './AsyncAction';\nimport { Subscription } from '../Subscription';\nimport { AsyncScheduler } from './AsyncScheduler';\n\nexport class VirtualTimeScheduler extends AsyncScheduler {\n\n protected static frameTimeFactor: number = 10;\n\n public frame: number = 0;\n public index: number = -1;\n\n constructor(SchedulerAction: typeof AsyncAction = VirtualAction,\n public maxFrames: number = Number.POSITIVE_INFINITY) {\n super(SchedulerAction, () => this.frame);\n }\n\n /**\n * Prompt the Scheduler to execute all of its queued actions, therefore\n * clearing its queue.\n * @return {void}\n */\n public flush(): void {\n\n const {actions, maxFrames} = this;\n let error: any, action: AsyncAction<any>;\n\n while ((action = actions.shift()) && (this.frame = action.delay) <= maxFrames) {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n }\n\n if (error) {\n while (action = actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n\n/**\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n */\nexport class VirtualAction<T> extends AsyncAction<T> {\n\n protected active: boolean = true;\n\n constructor(protected scheduler: VirtualTimeScheduler,\n protected work: (this: VirtualAction<T>, state?: T) => void,\n protected index: number = scheduler.index += 1) {\n super(scheduler, work);\n this.index = scheduler.index = index;\n }\n\n public schedule(state?: T, delay: number = 0): Subscription {\n if (!this.id) {\n return super.schedule(state, delay);\n }\n this.active = false;\n // If an action is rescheduled, we save allocations by mutating its state,\n // pushing it to the end of the scheduler queue, and recycling the action.\n // But since the VirtualTimeScheduler is used for testing, VirtualActions\n // must be immutable so they can be inspected later.\n const action = new VirtualAction(this.scheduler, this.work);\n this.add(action);\n return action.schedule(state, delay);\n }\n\n protected requestAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): any {\n this.delay = scheduler.frame + delay;\n const {actions} = scheduler;\n actions.push(this);\n actions.sort(VirtualAction.sortActions);\n return true;\n }\n\n protected recycleAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): any {\n return undefined;\n }\n\n protected _execute(state: T, delay: number): any {\n if (this.active === true) {\n return super._execute(state, delay);\n }\n }\n\n public static sortActions<T>(a: VirtualAction<T>, b: VirtualAction<T>) {\n if (a.delay === b.delay) {\n if (a.index === b.index) {\n return 0;\n } else if (a.index > b.index) {\n return 1;\n } else {\n return -1;\n }\n } else if (a.delay > b.delay) {\n return 1;\n } else {\n return -1;\n }\n }\n}\n"]}