Sha256: 961aa361ec3da04bb0d823b6d5cbdeedf2063e00e12731a827e1ee4cc4591b18
Contents?: true
Size: 1.35 KB
Versions: 49
Compression:
Stored size: 1.35 KB
Contents
import { AsyncAction } from './AsyncAction'; import { Subscription } from '../Subscription'; import { QueueScheduler } from './QueueScheduler'; /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ export class QueueAction<T> extends AsyncAction<T> { constructor(protected scheduler: QueueScheduler, protected work: (this: QueueAction<T>, state?: T) => void) { super(scheduler, work); } public schedule(state?: T, delay: number = 0): Subscription { if (delay > 0) { return super.schedule(state, delay); } this.delay = delay; this.state = state; this.scheduler.flush(this); return this; } public execute(state: T, delay: number): any { return (delay > 0 || this.closed) ? super.execute(state, delay) : this._execute(state, delay) ; } protected requestAsyncId(scheduler: QueueScheduler, id?: any, delay: number = 0): any { // If delay exists and is greater than 0, or if the delay is null (the // action wasn't rescheduled) but was originally scheduled as an async // action, then recycle as an async action. if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) { return super.requestAsyncId(scheduler, id, delay); } // Otherwise flush the scheduler starting with this action. return scheduler.flush(this); } }
Version data entries
49 entries across 49 versions & 4 rubygems