Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "helpers"

Index

Type aliases

PipelinePredicate

PipelinePredicate: (data: any) => void

Type declaration

    • (data: any): void
    • Parameters

      • data: any

      Returns void

PipelinePredicateAsync

PipelinePredicateAsync: (data: any) => Promise<void>

Type declaration

    • (data: any): Promise<void>
    • Parameters

      • data: any

      Returns Promise<void>

PollPredicate

PollPredicate: () => boolean

Type declaration

    • (): boolean
    • Returns boolean

PollPredicateAsync

PollPredicateAsync: () => Promise<boolean>

Type declaration

    • (): Promise<boolean>
    • Returns Promise<boolean>

TimesPredicate

TimesPredicate: (counter: number) => void

Type declaration

    • (counter: number): void
    • Parameters

      • counter: number

      Returns void

TimesPredicateAsync

TimesPredicateAsync: (counter: number) => Promise<void>

Type declaration

    • (counter: number): Promise<void>
    • Parameters

      • counter: number

      Returns Promise<void>

UntilPredicate

UntilPredicate<T>: () => T

Type parameters

  • T

Type declaration

    • (): T
    • Returns T

UntilPredicateAsync

UntilPredicateAsync<T>: () => Promise<T>

Type parameters

  • T

Type declaration

    • (): Promise<T>
    • Returns Promise<T>

Functions

pipeline

  • Executes a given array of functions with interval. Each function recieves an output of a previous one. If a timeout is number, the value is used between executions only i.e. the first function will be called with 0 timeout value. Otherwise a given function must calculate timeout value for the first call.

    Parameters

    Returns Promise<any>

    Output of the last function.

poll

  • Implements polling mechanism using Interval.

    Parameters

    Returns Promise<void>

sleep

  • sleep(time: number): Promise<void>
  • Returns a promise that gets resolved in a given period.

    Parameters

    • time: number

      Sleep period.

    Returns Promise<void>

times

  • Executes a given function a specific amount of times.

    Parameters

    • predicate: TimesPredicate | TimesPredicateAsync

      A function to call.

    • amount: number

      A number that indicates how many times to call a given function.

    • timeout: Duration

      A number or function returning a number that indicates time in ms between calls.

    Returns Promise<void>

until

  • Implements polling mechanism using Interval until data or null is returned.

    Type parameters

    • T

    Parameters

    Returns Promise<T>

Generated using TypeDoc