2014-09-30 14:56:33 -04:00
|
|
|
library angular.core.facade.async;
|
|
|
|
|
|
|
|
import 'dart:async';
|
|
|
|
export 'dart:async' show Future;
|
|
|
|
|
2014-10-10 15:44:56 -04:00
|
|
|
class PromiseWrapper {
|
|
|
|
static Future resolve(obj) {
|
2014-09-30 14:56:33 -04:00
|
|
|
return new Future.value(obj);
|
|
|
|
}
|
|
|
|
|
2014-10-10 15:44:56 -04:00
|
|
|
static Future reject(obj) {
|
2014-10-07 09:04:11 -04:00
|
|
|
return new Future.error(obj);
|
|
|
|
}
|
|
|
|
|
2014-10-10 15:44:56 -04:00
|
|
|
static Future all(List<Future> promises){
|
|
|
|
return Future.wait(promises);
|
2014-09-30 14:56:33 -04:00
|
|
|
}
|
2014-10-07 09:04:11 -04:00
|
|
|
|
2014-10-10 15:44:56 -04:00
|
|
|
static Future then(Future promise, Function success, Function onError){
|
|
|
|
return promise.then(success, onError: onError);
|
2014-10-07 09:04:11 -04:00
|
|
|
}
|
2014-09-30 14:56:33 -04:00
|
|
|
}
|