Home Manual Reference Source Test Repository
public interface | 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.

interface Action extends Subscription {
  work: (state?: any) => void|Subscription;
  state?: any;
  delay?: number;
  schedule(state?: any, delay?: number): void;
  execute(): void;
  scheduler: Scheduler;
  error: any;
}

Member Summary

Public Members
public

Represents the time (relative to the Scheduler's own clock) when this action should be executed.

public

The Scheduler which owns this action.

public

state: any

The current state.

Method Summary

Public Methods
public

execute(): any

Immediately executes this action and the work it contains.

public

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

Schedules this action on its parent Scheduler for execution.

public

work(state: any): Subscription

The function that represents the raw work to be executed on a Scheduler.

Inherited Summary

From class Subscription
public

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

public

add(teardown: TeardownLogic): Subscription

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 Members

public delay: number source

Represents the time (relative to the Scheduler's own clock) when this action should be executed.

public scheduler: Scheduler source

The Scheduler which owns this action.

public state: any source

The current state. This is the object that will be given to the work method.

Public Methods

public execute(): any source

Immediately executes this action and the work it contains.

Return:

any

public schedule(state: any, 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 any
  • 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

public work(state: any): Subscription source

The function that represents the raw work to be executed on a Scheduler.

Params:

NameTypeAttributeDescription
state any
  • optional

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

Return:

Subscription (nullable: true)

A subscription in order to be able to unsubscribe the scheduled work.