Home Manual Reference Source Test Repository
public class | source

Action

Extends:

Subscription → Action

A unit of work to be executed in a Scheduler. An action is typically created from within a Scheduler and an RxJS user does not need to concern themselves about creating and manipulating an Action.

class Action<T> extends Subscription {
  new (scheduler: Scheduler, work: (state?: T) => void);
  schedule(state?: T, delay: number = 0): Subscription;
}

Method Summary

Public Methods
public

schedule(state: T, delay: number): void

Schedules this action on its parent Scheduler for execution.

Inherited Summary

From class Subscription
public

A flag to indicate whether this Subscription has already been unsubscribed.

public

Adds a tear down to be called during the unsubscribe() of this Subscription.

public

remove(subscription: Subscription): void

Removes a Subscription from the internal list of subscriptions that will unsubscribe during the unsubscribe process of this Subscription.

public

unsubscribe(): void

Disposes the resources held by the subscription.

Public Methods

public schedule(state: T, delay: number): void source

Schedules this action on its parent Scheduler for execution. May be passed some context object, state. May happen at some point in the future, according to the delay parameter, if specified.

Params:

NameTypeAttributeDescription
state T
  • optional

Some contextual data that the work function uses when called by the Scheduler.

delay number
  • optional

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

Return:

void