Home Manual Reference Source Test Repository
import {Scheduler} from '@reactivex/rxjs/es6/Scheduler.js'
public class | source

Scheduler

Direct Subclass:

es6/scheduler/AsyncScheduler.js~AsyncScheduler

Indirect Subclass:

es6/scheduler/AnimationFrameScheduler.js~AnimationFrameScheduler, es6/scheduler/AsapScheduler.js~AsapScheduler, es6/scheduler/QueueScheduler.js~QueueScheduler, es6/testing/TestScheduler.js~TestScheduler, es6/scheduler/VirtualTimeScheduler.js~VirtualTimeScheduler

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 Action.

class Scheduler {
  now(): number;
  schedule(work, delay?, state?): Subscription;
}

Test:

Method Summary

Public Methods
public

schedule(work: function(state: ?T): ?Subscription, delay: number, state: T): Subscription

Schedules a function, work, for execution.

Public Methods

public schedule(work: function(state: ?T): ?Subscription, delay: number, state: T): Subscription source

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.

Params:

NameTypeAttributeDescription
work function(state: ?T): ?Subscription

A function representing a task, or some unit of work to be executed by the Scheduler.

delay number
  • optional

Time to wait before executing the work, where the time unit is implicit and defined by the Scheduler itself.

state T
  • optional

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.