feat(zone): add support for long stack traces

This commit is contained in:
vsavkin
2014-12-11 11:36:05 -08:00
parent d5fcac4d7a
commit df21c3c77d
14 changed files with 283 additions and 49 deletions

View File

@ -12,11 +12,11 @@ class PromiseWrapper {
return new Future.error(obj);
}
static Future<List> all(List<Future> promises){
static Future<List> all(List<Future> promises) {
return Future.wait(promises);
}
static Future then(Future promise, Function success, Function onError){
static Future then(Future promise, Function success, Function onError) {
if (success == null) return promise.catchError(onError);
return promise.then(success, onError: onError);
}
@ -24,13 +24,24 @@ class PromiseWrapper {
static completer(){
return new _Completer(new Completer());
}
static setTimeout(fn, millis) {
new Timer(new Duration(milliseconds: millis), fn);
}
}
class _Completer {
Completer c;
_Completer(this.c);
get promise => c.future;
get complete => c.complete;
get reject => c.completeError;
complete(v) {
c.complete(v);
}
reject(v) {
c.completeError(v);
}
}

View File

@ -33,4 +33,8 @@ export class PromiseWrapper {
reject: reject
};
}
static setTimeout(fn, millis) {
window.setTimeout(fn, millis);
}
}

View File

@ -59,6 +59,24 @@ export class StringMapWrapper {
}
}
}
static merge(m1, m2) {
var m = {};
for (var attr in m1) {
if (m1.hasOwnProperty(attr)){
m[attr] = m1[attr];
}
}
for (var attr in m2) {
if (m2.hasOwnProperty(attr)){
m[attr] = m2[attr];
}
}
return m;
}
}
export class ListWrapper {

View File

@ -214,4 +214,8 @@ export function assertionsEnabled() {
} catch (e) {
return true;
}
}
export function print(obj) {
console.log(obj);
}