new WKcAysnc() → {Object}
$wk$.WKcAsync is a class the objects of which
serialize asynchronous tasks.
Each object of this class defines a queue and a pool where asynchrounous tasks can be put.
By means of the method push a asynchronous task is
enqueue. It is executed as soon as all tasks that have been enqueued
earlier have finished.
By means of the method add a named asynchronous task is
added to the task pool. Additionally, the ids of all tasks, the
new task depends on, have to be stated. The task is executed
as soon as all tasks it depends on have finished.
Returns:
A new async object.
- Type
- Object
Methods
-
add(p_id, p_ids, p_env, p_doit, p_args) → {Object}
-
Adds new asynchronous tasks to the task pool. That task is executed as soons as all tasks it depends on have finished.
Parameters:
Name Type Argument Description p_idString The id of the task. It is not possible to add a second task with the same id as an elder task. In that case an error is dispatched; p_idsArray.<String> | Array <optional>
The ids of those tasks, the new task depends on. p_envObject <optional>
The environment which can be accessed via this.p_doitfunction The function that performs a task asynchronously p_argsObject[] The arguments passed to p_doitwhen executed. Every function for which the propertyNO_CALLBACKhas either not been set or is not equal totrueis considered to be a callback function.p_doitmust call at least one callback function. If no function has been stated, an callback function is created automatically and passed as last argument todoit.Returns:
this- Type
- Object
-
push(p_env, p_doit, p_args) → {Object}
-
Enqueues new asynchronous tasks. That task is executed as soons as all tasks that have been enqueue before have finished.
Parameters:
Name Type Argument Description p_envObject <optional>
The environment which can be accessed via this.p_doitfunction The function that performs a task asynchronously p_argsObject[] The arguments passed to p_doitwhen executed. Every function for which the propertyNO_CALLBACKhas either not been set or is not equal totrueis considered to be a callback function.p_doitmust call at least one callback function. If no function has been stated, an callback function is created automatically and passed as last argument todoit.Returns:
this- Type
- Object