feat(facade): add a way to detect if an object is a Promise
This commit is contained in:
parent
695923dcd6
commit
fc50829481
|
@ -34,6 +34,10 @@ class PromiseWrapper {
|
||||||
async.scheduleMicrotask(fn);
|
async.scheduleMicrotask(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isPromise(obj) {
|
||||||
|
return obj is Future;
|
||||||
|
}
|
||||||
|
|
||||||
static PromiseCompleter<dynamic> completer() =>
|
static PromiseCompleter<dynamic> completer() =>
|
||||||
new PromiseCompleter(new Completer());
|
new PromiseCompleter(new Completer());
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,8 @@ export class PromiseWrapper {
|
||||||
PromiseWrapper.then(PromiseWrapper.resolve(null), computation, (_) => {});
|
PromiseWrapper.then(PromiseWrapper.resolve(null), computation, (_) => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static isPromise(obj: any): boolean { return obj instanceof Promise; }
|
||||||
|
|
||||||
static completer(): PromiseCompleter<any> {
|
static completer(): PromiseCompleter<any> {
|
||||||
var resolve;
|
var resolve;
|
||||||
var reject;
|
var reject;
|
||||||
|
|
Loading…
Reference in New Issue