feat(zone): add initial implementation of VmTurnZone

This commit is contained in:
vsavkin
2014-12-05 18:30:45 -08:00
parent 4a08bbf7f1
commit df36ffb11d
14 changed files with 269 additions and 5 deletions

View File

@ -20,4 +20,17 @@ class PromiseWrapper {
if (success == null) return promise.catchError(onError);
return promise.then(success, onError: onError);
}
static completer(){
return new _Completer(new Completer());
}
}
class _Completer {
Completer c;
_Completer(this.c);
get promise => c.future;
get complete => c.complete;
}

View File

@ -17,4 +17,20 @@ export class PromiseWrapper {
static then(promise:Promise, success:Function, rejection:Function):Promise {
return promise.then(success, rejection);
}
static completer() {
var resolve;
var reject;
var p = new Promise(function(res, rej) {
resolve = res;
reject = rej;
});
return {
promise: p,
complete: resolve,
reject: reject
};
}
}

View File

@ -97,6 +97,7 @@ class ListWrapper {
static void insert(List l, int index, value) { l.insert(index, value); }
static void removeAt(List l, int index) { l.removeAt(index); }
static void clear(List l) { l.clear(); }
static String join(List l, String s) => l.join(s);
}
bool isListLikeIterable(obj) => obj is Iterable;

View File

@ -121,11 +121,16 @@ export class ListWrapper {
list.splice(index, 0, value);
}
static removeAt(list, index:int) {
var res = list[index];
list.splice(index, 1);
return res;
}
static clear(list) {
list.splice(0, list.length);
}
static join(list, s) {
return list.join(s);
}
}
export function isListLikeIterable(obj):boolean {