class com.babylonhx.tools.AsyncLoop

Available on all platforms

... @author Krtolica Vujadin

Class Fields

static function Run(iterations:Int, _fn:AsyncLoop ->Void_successCallback:Void ->Void, ?offset:Int):AsyncLoop

Helper function

static function SyncAsyncForLoop(iterations:Int, syncedIterations:Int, fn:Int ->Voidcback:Void ->Void, ?breakFunction:Void ->Bool, ?timeout:Int):Void

A for-loop that will run a given number of iterations synchronous and the rest async. @constructor

iterations

total number of iterations

syncedIterations

number of synchronous iterations in each async iteration.

fn

the function to call each iteration.

callback

a success call back that will be called when iterating stops.

breakFunction

a break condition (optional)

timeout

timeout settings for the setTimeout function. default - 0.

Instance Fields

function new(iterations:Int, _fn:AsyncLoop ->Void_successCallback:Void ->Void, ?offset:Int):Void

Constructor.

iterations

the number of iterations.

_fn

the function to run each iteration

_successCallback

the callback that will be called upon succesful execution

offset

starting offset.

function breakLoop():Void

Break the loop and run the success callback.

function executeNext():Void

Execute the next iteration. Must be called after the last iteration was finished.