abstract Callback<T>(CallbackData<T>)
package haxe.async
from CallbackData<T>,
Available on all platforms
A callback. All callbacks in the standard library are functions which accept
two arguments: an error (haxe.Error) and a result (T). If error is
non-null, result must be null. The callback type is declared in CallbackData.
This abstract defines multiple @:from conversions to improve readability of
callback code.
Static methods
staticinlinefromErrorOnly (f:Error ‑> Void):Callback<NoData>
Wraps a function which takes a single haxe.Error argument into a callback
of type Callback<NoData>. Allows:
var cb:Callback<NoData> = (err) -> trace("error!", err);staticinlinefromErrorResult<T> (f:Error ‑> T ‑> Void):Callback<T>
Wraps a callback function declared without ? (optional) arguments into a
callback.
staticinlinefromOptionalErrorOnly (f:Error ‑> Void):Callback<NoData>
Wraps a function which takes a single optional haxe.Error argument into
a callback of type Callback<NoData>. Allows:
var cb:Callback<NoData> = (?err) -> trace("error!", err);