fix(Dart1.8): Promise handling
This commit is contained in:
parent
0703ee526c
commit
fc2181ec4e
|
@ -203,9 +203,10 @@ class _AsyncInjectorStrategy {
|
|||
var deps = this.injector._resolveDependencies(key, binding, true);
|
||||
var depsPromise = PromiseWrapper.all(deps);
|
||||
|
||||
var promise = PromiseWrapper.then(depsPromise, null, (e) => this._errorHandler(key, e)).
|
||||
then(deps => this._findOrCreate(key, binding, deps)).
|
||||
then(instance => this._cacheInstance(key, instance));
|
||||
var promise = PromiseWrapper
|
||||
.then(depsPromise, null, (e) => this._errorHandler(key, e))
|
||||
.then(deps => this._findOrCreate(key, binding, deps))
|
||||
.then(instance => this._cacheInstance(key, instance));
|
||||
|
||||
this.injector._setInstance(key, new _Waiting(promise));
|
||||
return promise;
|
||||
|
|
|
@ -12,11 +12,12 @@ class PromiseWrapper {
|
|||
return new Future.error(obj);
|
||||
}
|
||||
|
||||
static Future all(List<Future> promises){
|
||||
static Future<List> all(List<Future> promises){
|
||||
return Future.wait(promises);
|
||||
}
|
||||
|
||||
static Future then(Future promise, Function success, Function onError){
|
||||
if (success == null) return promise.catchError(onError);
|
||||
return promise.then(success, onError: onError);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue