always produces a promise
// use it as wrapper to get a promise
return when(thing).then((thing)=> doSomethingWithTheThing);
import when from "apprt-core/when";
// bind success and error handler from an object
var scope = {
counter : 0,
ok() {
++this.counter;
},
error() {
--this.counter;
}
};
return when(thing, scope.ok, scope.error, scope);
Same as the first overload, but without an error callback.
Generated using TypeDoc
Helper to create stable code if a value can be a promise or a non async value.