AsyncOperation
class AsyncOperation<T> implements AsyncResult<T>
- henkolib
- henkolib.async
- henkolib.async.AsyncOperation
- henkolib.async
Class overview
You can use the AsyncOperation class to return from asynchronous functions immediately. The returned AsyncOperation object contains event handlers for completion, error and change in progress, and these properties can be read at your convenience with the corresponding functions.
Public functions
new ()
setResult (result : T)
result The final result of the asynchronous call.
Using setResult will trigger the AsyncOperation's onComplete event handler. Functions that subscribe to the onComplete event will be called with the result object as a parameter.
setError (error : String)
error The errormessage of the failed asynchronous call.
Using setError will trigger the AsyncOperation's onError event handler. Functions that subscribe to the onError event will be called with the error string as a parameter.
setProgress (progress : Float)
progress The current progress of the corresponding function.
Using setProgress will trigger the AsyncOperation's onProgress event handler. Functions that subscribe to the onProgress event will be called with the progress variable as a parameter.
Implemented interface functions
isCompleted () : Bool from AsyncResult
isError () from AsyncResult
getError () : String from AsyncResult
getProgress () : Float from AsyncResult
getResult () : T from AsyncResult
getElapsedTime () : Date from AsyncResult