refactor(Completer): rename complete() to resolve()
This commit is contained in:
parent
6ad2c18277
commit
41c61e5bc7
|
@ -125,7 +125,7 @@ export function bootstrap(appComponentType: Type, bindings: List<Binding>=null,
|
|||
lc.registerWith(zone, rootView.changeDetector);
|
||||
lc.tick(); //the first tick that will bootstrap the app
|
||||
|
||||
bootstrapProcess.complete(appInjector);
|
||||
bootstrapProcess.resolve(appInjector);
|
||||
},
|
||||
|
||||
(err) => {
|
||||
|
|
|
@ -11,7 +11,7 @@ export class XHRImpl extends XHR {
|
|||
xhr.onload = function() {
|
||||
var status = xhr.status;
|
||||
if (200 <= status && status <= 300) {
|
||||
completer.complete(xhr.responseText);
|
||||
completer.resolve(xhr.responseText);
|
||||
} else {
|
||||
completer.reject(`Failed to load ${url}`);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class _Completer {
|
|||
|
||||
Future get promise => c.future;
|
||||
|
||||
void complete(v) {
|
||||
void resolve(v) {
|
||||
c.complete(v);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ export class PromiseWrapper {
|
|||
|
||||
return {
|
||||
promise: p,
|
||||
complete: resolve,
|
||||
resolve: resolve,
|
||||
reject: reject
|
||||
};
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ class _PendingRequest {
|
|||
if (isBlank(response)) {
|
||||
this.completer.reject(`Failed to load ${this.url}`);
|
||||
} else {
|
||||
this.completer.complete(response);
|
||||
this.completer.resolve(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@ export function main() {
|
|||
b.promise.then((_) => log.add('b then'));
|
||||
});
|
||||
|
||||
a.complete("a");
|
||||
b.complete("b");
|
||||
a.resolve("a");
|
||||
b.resolve("b");
|
||||
|
||||
PromiseWrapper.all([a.promise, b.promise]).then((_) => {
|
||||
expect(log.result()).toEqual('onTurnStart; run start; onTurnDone; onTurnStart; a then; onTurnDone; onTurnStart; b then; onTurnDone');
|
||||
|
@ -109,7 +109,7 @@ export function main() {
|
|||
zone.run(function () {
|
||||
PromiseWrapper.setTimeout(function () {
|
||||
PromiseWrapper.setTimeout(function () {
|
||||
c.complete(null);
|
||||
c.resolve(null);
|
||||
throw new BaseException('ccc');
|
||||
}, 0);
|
||||
}, 0);
|
||||
|
@ -130,7 +130,7 @@ export function main() {
|
|||
zone.run(function () {
|
||||
PromiseWrapper.resolve(null).then((_) => {
|
||||
return PromiseWrapper.resolve(null).then((__) => {
|
||||
c.complete(null);
|
||||
c.resolve(null);
|
||||
throw new BaseException("ddd");
|
||||
});
|
||||
});
|
||||
|
@ -152,7 +152,7 @@ export function main() {
|
|||
zone.run(function () {
|
||||
PromiseWrapper.setTimeout(function () {
|
||||
PromiseWrapper.setTimeout(function () {
|
||||
c.complete(null);
|
||||
c.resolve(null);
|
||||
throw new BaseException('ccc');
|
||||
}, 0);
|
||||
}, 0);
|
||||
|
|
|
@ -65,7 +65,7 @@ export class PerflogMetric extends Metric {
|
|||
}
|
||||
var completer = PromiseWrapper.completer();
|
||||
this._setTimeout(
|
||||
() => completer.complete(this._readUntilEndMark(markName, loopCount+1)),
|
||||
() => completer.resolve(this._readUntilEndMark(markName, loopCount+1)),
|
||||
100
|
||||
);
|
||||
return completer.promise;
|
||||
|
@ -165,4 +165,4 @@ var _BINDINGS = [
|
|||
[WebDriverExtension, _SET_TIMEOUT]
|
||||
),
|
||||
bind(_SET_TIMEOUT).toValue( (fn, millis) => PromiseWrapper.setTimeout(fn, millis) )
|
||||
];
|
||||
];
|
||||
|
|
|
@ -21,7 +21,7 @@ export class SeleniumWebDriverAdapter extends WebDriverAdapter {
|
|||
// selenium-webdriver uses an own Node.js context,
|
||||
// so we need to convert data into objects of this context.
|
||||
// (e.g. otherwise instanceof checks of rtts_assert would fail)
|
||||
(data) => completer.complete(convertToLocalProcess(data)),
|
||||
(data) => completer.resolve(convertToLocalProcess(data)),
|
||||
completer.reject
|
||||
);
|
||||
return completer.promise;
|
||||
|
@ -58,4 +58,4 @@ function convertToLocalProcess(data) {
|
|||
return undefined;
|
||||
}
|
||||
return JSON.parse(serialized);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue