Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a composite of cancelable references that are stacked, so you can push a new reference, or pop an existing one and when it gets canceled, then the whole stack gets canceled.

The references are pushed and popped in a FIFO order.

Used in the implementation of Task.

final

Hierarchy

  • StackedCancelable

Implements

Index

Constructors

constructor

Methods

cancel

  • cancel(): void

isCanceled

  • isCanceled(): boolean

pop

  • Removes a cancelable reference from the stack in FIFO order.

    Returns ICancelable

    the cancelable reference that was removed.

push

  • Pushes a cancelable reference on the stack, to be popped or cancelled later in FIFO order.

    Parameters

    Returns this

Static collection

  • Returns a StackedCancelable that's initialized with the given list of cancelable references.

    const list = StackedCancelable.collection(
      Cancelable.of(() => console.log("Cancelled #1")),
      Cancelable.of(() => console.log("Cancelled #2")),
      Cancelable.of(() => console.log("Cancelled #3"))
    )
    
    // Popping cancelable no. 3 from the stack
    list.pop()
    
    list.cancel()
    //=> Cancelled #1
    //=> Cancelled #2
    

    Parameters

    • Rest ...refs: Array<ICancelable>

      is the array of references to cancel when cancellation is triggered

    Returns StackedCancelable

Static empty

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc