Class AsyncLoop
Hierarchy
- AsyncLoop
Index
Constructors
constructor
Constructor.
Parameters
iterations: number
the number of iterations.
func: ((asyncLoop: AsyncLoop) => void)
the function to run each iteration
Parameters
asyncLoop: AsyncLoop
Returns void
successCallback: (() => void)
the callback that will be called upon successful execution
Returns void
Optional offset: number
starting offset.
Returns AsyncLoop
Properties
indexSearch playground for index
Defines the current index of the loop.
iterationsSearch playground for iterations
Defines the number of iterations for the loop
Methods
break LoopSearch playground for breakLoop
Break the loop and run the success callback.
Returns void
execute NextSearch playground for executeNext
Execute the next iteration. Must be called after the last iteration was finished.
Returns void
Static RunSearch playground for Run
Create and run an async loop.
Parameters
iterations: number
the number of iterations.
fn: ((asyncLoop: AsyncLoop) => void)
the function to run each iteration
Parameters
asyncLoop: AsyncLoop
Returns void
successCallback: (() => void)
the callback that will be called upon successful execution
Returns void
Optional offset: number
starting offset.
Returns AsyncLoop
the created async loop object
Static Sync Async For LoopSearch playground for SyncAsyncForLoop
A for-loop that will run a given number of iterations synchronous and the rest async.
Parameters
iterations: number
total number of iterations
syncedIterations: number
number of synchronous iterations in each async iteration.
fn: ((iteration: number) => void)
the function to call each iteration.
Parameters
iteration: number
Returns void
callback: (() => void)
a success call back that will be called when iterating stops.
Returns void
Optional breakFunction: (() => boolean)
a break condition (optional)
Returns boolean
Optional timeout: number
timeout settings for the setTimeout function. default - 0.
Returns AsyncLoop
the created async loop object
An implementation of a loop for asynchronous functions.