trait Async extends Object
Async Type Definition
- Annotations
- @RawJSType() @native()
- Alphabetic
- By Inheritance
- Async
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def applyEach(functions: Array[Function], args: Any, args2: Any, args3: Any, args4: Any, args5: Any, args6: Any, callback: Function): Unit
- def applyEach(functions: Array[Function], args: Any, args2: Any, args3: Any, args4: Any, args5: Any, callback: Function): Unit
- def applyEach(functions: Array[Function], args: Any, args2: Any, args3: Any, args4: Any, callback: Function): Unit
- def applyEach(functions: Array[Function], args: Any, args2: Any, args3: Any, callback: Function): Unit
- def applyEach(functions: Array[Function], args: Any, args2: Any, callback: Function): Unit
-
def
applyEach(functions: Array[Function], args: Any, callback: Function): Unit
Applies the provided arguments to each function in the array, calling callback after all functions have completed.
Applies the provided arguments to each function in the array, calling callback after all functions have completed. If you only provide the first argument, then it will return a function which lets you pass in the arguments as if it were a single function call.
- functions
A collection of asynchronous functions to all call with the same arguments
- args
any number of separate arguments to pass to the function
- callback
the final argument should be the callback, called when all functions have completed processing
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
compose(functions: Function*): AsyncResultCallback
Creates a function which is a composition of the passed asynchronous functions.
Creates a function which is a composition of the passed asynchronous functions. Each function consumes the return value of the function that follows. Composing functions f(), g(), and h() would produce the result of f(g(h())), only this version uses callbacks to obtain the return values.
- functions
the asynchronous functions to compose
compose(fn1, fn2...)
Example: -
def
each(coll: Array[_ <: Any], iteratee: Function, callback: AsyncResultCallback = null): Unit
Applies the function iteratee to each item in coll, in parallel.
Applies the function iteratee to each item in coll, in parallel. The iteratee is called with an item from the list, and a callback for when it has finished. If the iteratee passes an error to its callback, the main callback (for the each function) is immediately called with the error.
Note, that since this function applies iteratee to each item in parallel, there is no guarantee that the iteratee functions will complete in order.
- coll
A collection to iterate over.
- iteratee
A function to apply to each item in coll. The iteratee is passed a callback(err) which must be called once it has completed. If no error has occurred, the callback should be run without arguments or with an explicit null argument. The array index is not passed to the iteratee. If you need the index, use forEachOf.
- callback
An optional callback which is called when all iteratee functions have finished, or an error occurs.
-
def
eachLimit(coll: Array[_ <: Any], limit: Int, iteratee: Function, callback: AsyncResultCallback = null): Unit
Applies the function iteratee to each item in coll, in parallel.
Applies the function iteratee to each item in coll, in parallel. The iteratee is called with an item from the list, and a callback for when it has finished. If the iteratee passes an error to its callback, the main callback (for the each function) is immediately called with the error.
Note, that since this function applies iteratee to each item in parallel, there is no guarantee that the iteratee functions will complete in order.
- coll
A collection to iterate over.
- limit
the limit
- iteratee
A function to apply to each item in coll. The iteratee is passed a callback(err) which must be called once it has completed. If no error has occurred, the callback should be run without arguments or with an explicit null argument. The array index is not passed to the iteratee. If you need the index, use forEachOf.
- callback
Optional A callback which is called when all iteratee functions have finished, or an error occurs.
-
def
eachSeries(coll: Array[_ <: Any], iteratee: Function, callback: AsyncResultCallback = null): Unit
Applies the function iteratee to each item in coll, in parallel.
Applies the function iteratee to each item in coll, in parallel. The iteratee is called with an item from the list, and a callback for when it has finished. If the iteratee passes an error to its callback, the main callback (for the each function) is immediately called with the error.
Note, that since this function applies iteratee to each item in parallel, there is no guarantee that the iteratee functions will complete in order.
- coll
A collection to iterate over.
- iteratee
A function to apply to each item in coll. The iteratee is passed a callback(err) which must be called once it has completed. If no error has occurred, the callback should be run without arguments or with an explicit null argument. The array index is not passed to the iteratee. If you need the index, use forEachOf.
- callback
An optional callback which is called when all iteratee functions have finished, or an error occurs.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
filter(coll: Array[_ <: Any], iteratee: Function, callback: AsyncResultCallback = null): Unit
Returns a new array of all the values in coll which pass an async truth test.
Returns a new array of all the values in coll which pass an async truth test. This operation is performed in parallel, but the results array will be in the same order as the original.
- coll
A collection to iterate over.
- iteratee
iteratee(item, callback) - A truth test to apply to each item in coll. The iteratee is passed a callback(err, truthValue) , which must be called with a boolean argument once it has completed. Callback arguments changed in 2.0
- callback
callback(err, results) - Optional A callback which is called after all the iteratee functions have finished.
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
forEachOf(coll: Any, iteratee: Function, callback: AsyncErrorCallback = null): Unit
Like each, except that it passes the key (or index) as the second argument to the iteratee.
Like each, except that it passes the key (or index) as the second argument to the iteratee.
- coll
A collection to iterate over.
- iteratee
iteratee(item, key, callback) - A function to apply to each item in coll. The key is the item's key, or index in the case of an array. The iteratee is passed a callback(err) which must be called once it has completed. If no error has occurred, the callback should be run without arguments or with an explicit null argument.
- callback
callback(err) - An optional callback which is called when all iteratee functions have finished, or an error occurs.
forEachOf(coll, iteratee, [callback])
Example: -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
def
map(coll: Array[_ <: Any], iteratee: Function, callback: AsyncResultCallback): Unit
Produces a new collection of values by mapping each value in coll through the iteratee function.
Produces a new collection of values by mapping each value in coll through the iteratee function. The iteratee is called with an item from coll and a callback for when it has finished processing. Each of these callback takes 2 arguments: an error, and the transformed item from coll. If iteratee passes an error to its callback, the main callback (for the map function) is immediately called with the error.
- coll
A collection to iterate over.
- iteratee
iteratee(item, callback) - A function to apply to each item in coll. The iteratee is passed a callback(err, transformed) which must be called once it has completed with an error (which can be null) and a transformed item.
- callback
callback(err, results) - Optional A callback which is called when all iteratee functions have finished, or an error occurs. Results is an array of the transformed items from the coll.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
parallel(tasks: Array[Function], callback: AsyncResultCallback = null): Unit
Run the tasks collection of functions in parallel, without waiting until the previous function has completed.
Run the tasks collection of functions in parallel, without waiting until the previous function has completed. If any of the functions pass an error to its callback, the main callback is immediately called with the value of the error. Once the tasks have completed, the results are passed to the final callback as an array.
- tasks
A collection containing functions to run. Each function is passed a callback(err, result) which it must call on completion with an error err (which can be null) and an optional result value.
- callback
callback(err, results) - An optional callback to run once all the functions have completed successfully. This function gets a results array (or object) containing all the result arguments passed to the task callbacks.
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
def
queue[T](worker: Function, concurrency: Int = 1): QueueObject[T]
Creates a queue object with the specified concurrency.
Creates a queue object with the specified concurrency. Tasks added to the queue are processed in parallel (up to the concurrency limit). If all workers are in progress, the task is queued until one becomes available. Once a worker completes a task, that task's callback is called.
- worker
An asynchronous function for processing a queued task, which must call its callback(err) argument when finished, with an optional error as an argument. If you want to handle errors from an individual task, pass a callback to q.push(). Invoked with (task, callback).
- concurrency
An integer for determining how many worker functions should be run in parallel. If omitted, the concurrency defaults to 1. If the concurrency is 0, an error is thrown.
- returns
A queue object to manage the tasks. Callbacks can attached as certain properties to listen for specific events during the lifecycle of the queue.
-
def
reject(coll: Any, iteratee: Function, callback: AsyncResultCallback = null): Unit
The opposite of filter.
The opposite of filter. Removes values that pass an async truth test.
- coll
A collection to iterate over.
- iteratee
iteratee(item, callback) - A truth test to apply to each item in coll. The iteratee is passed a callback(err, truthValue) , which must be called with a boolean argument once it has completed. Callback arguments changed in 2.0
- callback
callback(err, results) - Optional A callback which is called after all the iteratee functions have finished.
reject(coll, iteratee, [callback])
Example: -
def
seq(functions: Function): AsyncResultCallback
Version of the compose function that is more natural to read.
Version of the compose function that is more natural to read. Each function consumes the return value of the previous function. It is the equivalent of compose with the arguments reversed.
Each function is executed with the this binding of the composed function.
- functions
the asynchronous functions to compose
seq(fn1, fn2...)
Example: - def series(tasks: Array[Function]): Unit
-
def
setImmediate(callback: Function, args: Any*): Unit
Calls callback on a later loop around the event loop.
Calls callback on a later loop around the event loop. In Node.js this just calls setImmediate. In the browser it will use setImmediate if available, otherwise setTimeout(callback, 0), which means other higher priority events may precede the execution of callback.
This is used internally for browser-compatibility purposes.
- callback
The function to call on a later loop around the event loop.
- args
any number of additional arguments to pass to the callback on the next tick
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueOf(): Any
- Definition Classes
- Object
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
waterfall(tasks: Array[_ <: Function], callback: AsyncResultCallback = null): Unit
Runs the tasks array of functions in series, each passing their results to the next in the array.
Runs the tasks array of functions in series, each passing their results to the next in the array. However, if any of the tasks pass an error to their own callback, the next function is not executed, and the main callback is immediately called with the error.
- tasks
An array of functions to run, each function is passed a callback(err, result1, result2, ...) it must call on completion. The first argument is an error (which can be null) and any further arguments will be passed as arguments in order to the next task.
- callback
An optional callback to run once all the functions have completed. This will be passed the results of the last task's callback (e.g. callback(err, [results])).