Options
All
  • Public
  • Public/Protected
  • All
Menu

The SingleAssignCancelable is a Cancelable that can be assigned only once to another cancelable reference.

Example:

const ref = SingleAssignCancelable()
ref.update(c1) // sets the underlying cancelable to c1

ref.update(c2) // throws IllegalStateError

See MultiAssignCancelable for a similar type that can be assigned multiple types.

Hierarchy

  • SingleAssignCancelable

Implements

Index

Constructors

Methods

Constructors

constructor

Methods

cancel

  • cancel(): void

isCanceled

  • isCanceled(): boolean
  • Return true in case this cancelable hasn't been canceled, or false otherwise.

    const ref = BoolCancelable.of()
    
    ref.isCanceled() // false
    ref.cancel()
    ref.isCanceled() // true
    

    Returns boolean

update

  • Updates the internal reference of this assignable cancelable to the given value.

    If this cancelable is already canceled, then value is going to be canceled on assignment as well.

    Parameters

    Returns this

Static empty

Static of

  • Initiates an SingleAssignCancelable reference and assigns it a reference that wraps the given cb callback.

    So this code:

    SingleAssignCancelable.of(() => console.log("cancelled"))
    

    Is equivalent to this:

    const ref = SingleAssignCancelable.empty()
    ref.update(Cancelable.of(() => console.log("cancelled")))
    

    Parameters

    • cb: function
        • (): void
        • Returns void

    Returns SingleAssignCancelable

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