KofiLoop
Options
All
  • Public
  • Public/Protected
  • All
Menu

Class returned by loops.

use_reference

Never create the object yourself and always use reference.

Hierarchy

  • EventEmitter
    • LoopReturn

Implements

  • PromiseLike<any>

Index

Properties

Accessors

isPending

isPending:

Boolean indicating if the loop is pending.

readonly

isStopped

isStopped:

Boolean indicating if the loop is stopped.

readonly

Methods

catch

  • catch(callback: function): this
  • Alias for error: Called when an uncaught error is thrown.

    Parameters

    • callback: function
        • (): any
        • Returns any

    Returns this

end

  • end(callback: function, errorCallback?: undefined | function): this
  • Called when the loop is stopped.

    Parameters

    • callback: function
        • (value: any): any
        • Parameters

          • value: any

          Returns any

    • Optional errorCallback: undefined | function

    Returns this

error

  • error(callback: function): this
  • Called when an uncaught error is thrown.

    Parameters

    • callback: function
        • (err: any): any
        • Parameters

          • err: any

          Returns any

    Returns this

parent

  • parent(loop: Loop): this
  • Sets a loop as parent, and set pending for the parent loop until the end of the loop.

    throws

    {\Error} if parent is already defined.

    Parameters

    • loop: Loop

      The parent loop

    Returns this

run

  • run(): this
  • Starts or restarts the loop.

    Returns this

start

  • start(callback: function): this
  • Called when a loop is started.

    Parameters

    • callback: function

    Returns this

startLoop

  • startLoop(handler: Promise<any> | function, interval: number, ...args: any[]): LoopReturn
  • Starts a loop after the end of the current loop.

    see

    LoopSelf for handler scope ('this' reference).

    Parameters

    • handler: Promise<any> | function

      The function to loop

    • interval: number

      The interval in milliseconds

    • Rest ...args: any[]

      Some arguments to pass to function

    Returns LoopReturn

step

  • step(callback: function, step?: undefined | number): this
  • Called when a loop step is finished.

    Parameters

    • callback: function
        • Parameters

          Returns void

    • Optional step: undefined | number

    Returns this

stepStart

  • stepStart(callback: function, step?: undefined | number): this
  • Called when a loop step is started.

    Parameters

    • callback: function
    • Optional step: undefined | number

    Returns this

stop

  • stop(): void

terminated

  • terminated(callback: function): this
  • Called when the loop is terminated, even if there is an error.

    Parameters

    • callback: function

    Returns this

then

  • then(callback: function, errorCallback: function): this
  • Alias for end: Called when the loop is stopped.

    Parameters

    • callback: function
        • (value: any): any
        • Parameters

          • value: any

          Returns any

    • errorCallback: function
        • (err: any): any
        • Parameters

          • err: any

          Returns any

    Returns this

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