9 lines
209 B
JavaScript
9 lines
209 B
JavaScript
|
export function when(promise, callback, errback) {
|
||
|
if (promise && promise.then) {
|
||
|
return errback ?
|
||
|
promise.then(callback, errback) :
|
||
|
promise.then(callback);
|
||
|
}
|
||
|
return callback(promise);
|
||
|
}
|