feat(zone): add initial implementation of VmTurnZone
This commit is contained in:
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user