Async.Promise library¶
Async.Promise library¶
The Async.Promise library provides functions for handling asynchronous operations, such as loading a remote node database. All of these functions are contained in the “Async.Promise” and/or “Promise” Lua tables found in the “async.lua” unit.
Usage example:
| -- First, you need to use the “async.lua” unit require("async.lua"); -- Now you can access the functions of the library. Async.Promise.LIBRARY_FUNCTION(Argument1, Argument2, ...); or Promise.LIBRARY_FUNCTION(Argument1, Argument2, ...); |
|---|
Async.Promise library functions¶
| function Async.Promise.resolved(data) function Promise.resolved(data) |
|---|
Creates and returns a Promise object that has already been successfully resolved with the provided “data” argument
Arguments:
- data - the value that was successfully resolved. This can be any information you want to pass as a successful return value
Return:
- The new Promise object
| function Async.Promise.withError(errorMsg) function Async.Promise.withException(errorMsg) function Promise.withError(errorMsg) function Promise.withException(errorMsg) |
|---|
Creates and returns a Promise object that has already been resolved with a failure state and the provided error message
Arguments:
- errorMsg - The error message that describes why the Promise resolved to a failed state.
Return:
- The new Promise object
Created with the Personal Edition of HelpNDoc: Eliminate the Struggles of Documentation with a Help Authoring Tool