Wrapper for promise object, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
The main difference in ours is it allows multiple callbacks
require("ko/promise")(handler)
Example
var promise = new require("ko/promise")((resolve, reject, each)) { require("sdk/timers").setTimeout(() => { each("foo"); each("bar"); resolve("done"); }, 0); }); promise.each(console.log); promise.then(console.info);
Parameters:
Name | Type | Description |
---|---|---|
handler |
function |
|
Returns:
Instance of Promise