(
callback*
)
- Parameters:
-
callback* <Function|Object>
0..n callbacks to seed the queue
A specialized queue class that supports scheduling callbacks to execute sequentially, iteratively, even asynchronously.
Callbacks can be function refs or objects with the following keys. Only
the fn
key is required.
fn
-- The callback functioncontext
-- The execution context for the callbackFn.args
-- Arguments to pass to callbackFn.timeout
-- Millisecond delay before executing callbackFn.
(Applies to each iterative execution of callback)iterations
-- Number of times to repeat the callback.
until
-- Repeat the callback until this function returns
true. This setting trumps iterations.autoContinue
-- Set to false to prevent the AsyncQueue from
executing the next callback in the Queue after
the callback completes.id
-- Name that can be used to get, promote, get the
indexOf, or delete this callback.
(
callback*
)
callback*
<Function|Object>
0..n callbacks to seed the queue
protected {Boolean|Object} true for synchronous callback execution, the
return handle from Y.later for async callbacks.
Otherwise false.
static {Object}
Static default values used to populate callback configuration properties. Preconfigured defaults include:
autoContinue
: true
iterations
: 1timeout
: 10 (10ms between callbacks)until
: (function to run until iterations <= 0){Object}
protected
void
_defAddFn
(
e
)
added
property in the
after phase.
e
<Event>
the event object
protected
void
_defExecFn
(
e
)
e
<Event>
the event object
protected
void
_defPromoteFn
(
e
)
Default functionality for the "promote" event. Promotes the named callback to the head of the queue.
The event object will contain a property "callback", which holds the id of a callback or the callback object itself.
e
<Event>
the custom event
protected
void
_defRemoveFn
(
e
)
Default functionality for the "remove" event. Removes the callback from the queue.
The event object will contain a property "callback", which holds the id of a callback or the callback object itself.
e
<Event>
the custom event
protected
void
_defShiftFn
(
e
)
e
<Event>
The event object
protected
Boolean
_execute
(
callback
)
callback
<Object>
the callback object to execute
Boolean
protected
void
_init
(
)
protected
void
_initEvents
(
)
protected
Function
_prepare
(
callback
)
callback
<Object|Function>
the raw callback
Function
protected
Boolean
_schedule
(
callback
)
callback
<Object>
the callback object to execute
Boolean
AsyncQueue
add
(
callback*
)
callback*
<Function|Object>
0..n callbacks
AsyncQueue
Object
getCallback
(
id
)
id
<String>
the id assigned to the callback
Object
Number
indexOf
(
callback
)
callback
<String|Function>
the callback or its specified id
Number
Boolean
isRunning
(
)
Boolean
Function
next
(
)
Function
AsyncQueue
pause
(
)
AsyncQueue
AsyncQueue
promote
(
callback
)
callback
<String|Object>
the callback object or a callback's id
AsyncQueue
AsyncQueue
remove
(
callback
)
callback
<String|Object>
the callback object or a callback's id
AsyncQueue
AsyncQueue
run
(
)
AsyncQueue
Number
size
(
)
AsyncQueue
stop
(
)
AsyncQueue
complete
(
)