Sha256: 9fd7fde41ebf0586b532bb406ee1ede3181b28b931b7f5b29b9d1c1fcf2e32f4

Contents?: true

Size: 1.63 KB

Versions: 49

Compression:

Stored size: 1.63 KB

Contents

/**
 * An execution context and a data structure to order tasks and schedule their
 * execution. Provides a notion of (potentially virtual) time, through the
 * `now()` getter method.
 *
 * Each unit of work in a Scheduler is called an {@link Action}.
 *
 * ```ts
 * class Scheduler {
 *   now(): number;
 *   schedule(work, delay?, state?): Subscription;
 * }
 * ```
 *
 * @class Scheduler
 */
export class Scheduler {
    constructor(SchedulerAction, now = Scheduler.now) {
        this.SchedulerAction = SchedulerAction;
        this.now = now;
    }
    /**
     * Schedules a function, `work`, for execution. May happen at some point in
     * the future, according to the `delay` parameter, if specified. May be passed
     * some context object, `state`, which will be passed to the `work` function.
     *
     * The given arguments will be processed an stored as an Action object in a
     * queue of actions.
     *
     * @param {function(state: ?T): ?Subscription} work A function representing a
     * task, or some unit of work to be executed by the Scheduler.
     * @param {number} [delay] Time to wait before executing the work, where the
     * time unit is implicit and defined by the Scheduler itself.
     * @param {T} [state] Some contextual data that the `work` function uses when
     * called by the Scheduler.
     * @return {Subscription} A subscription in order to be able to unsubscribe
     * the scheduled work.
     */
    schedule(work, delay = 0, state) {
        return new this.SchedulerAction(this, work).schedule(state, delay);
    }
}
Scheduler.now = Date.now ? Date.now : () => +new Date();
//# sourceMappingURL=Scheduler.js.map

Version data entries

49 entries across 49 versions & 4 rubygems

Version Path
ilog-0.4.1 node_modules/rxjs/_esm2015/Scheduler.js
ilog-0.4.0 node_modules/rxjs/_esm2015/Scheduler.js
ilog-0.3.3 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-18.0.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.21.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.20.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.19.1 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.19.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.18.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.17.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.16.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.15.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.14.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.13.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.12.2 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.12.1 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.12.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.11.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.10.0 node_modules/rxjs/_esm2015/Scheduler.js
govuk_publishing_components-17.9.0 node_modules/rxjs/_esm2015/Scheduler.js