mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-16 00:43:20 +01:00
done with done, #57695
This commit is contained in:
@@ -160,7 +160,7 @@ export class Throttler {
|
||||
};
|
||||
|
||||
this.queuedPromise = new TPromise(c => {
|
||||
this.activePromise.then(onComplete, onComplete).done(c);
|
||||
this.activePromise.then(onComplete, onComplete).then(c);
|
||||
}, () => {
|
||||
this.activePromise.cancel();
|
||||
});
|
||||
@@ -176,7 +176,7 @@ export class Throttler {
|
||||
this.activePromise = promiseFactory();
|
||||
|
||||
return new TPromise((c, e) => {
|
||||
this.activePromise.done((result: any) => {
|
||||
this.activePromise.then((result: any) => {
|
||||
this.activePromise = null;
|
||||
c(result);
|
||||
}, (err: any) => {
|
||||
@@ -378,7 +378,7 @@ export function timeout(n: number): CancelablePromise<void> {
|
||||
* @returns `true` if candidate is a `WinJS.Promise`
|
||||
*/
|
||||
export function isWinJSPromise(candidate: any): candidate is TPromise {
|
||||
return isThenable(candidate) && typeof (<TPromise>candidate).done === 'function';
|
||||
return isThenable(candidate) && typeof (candidate as any).done === 'function';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -524,8 +524,8 @@ export class Limiter<T> {
|
||||
this.runningPromises++;
|
||||
|
||||
const promise = iLimitedTask.factory();
|
||||
promise.done(iLimitedTask.c, iLimitedTask.e);
|
||||
promise.done(() => this.consumed(), () => this.consumed());
|
||||
promise.then(iLimitedTask.c, iLimitedTask.e);
|
||||
promise.then(() => this.consumed(), () => this.consumed());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
-4
@@ -17,10 +17,6 @@ export class Promise<T = any> {
|
||||
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
||||
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
||||
|
||||
public done(
|
||||
onfulfilled?: (value: T) => void,
|
||||
onrejected?: (reason: any) => void): void;
|
||||
|
||||
public cancel(): void;
|
||||
|
||||
public static as(value: null): Promise<null>;
|
||||
|
||||
@@ -113,7 +113,7 @@ export class Client implements IChannelClient, IDisposable {
|
||||
const request: TPromise<void> = channel.call(name, arg);
|
||||
|
||||
const result = new TPromise<void>((c, e) => {
|
||||
request.then(c, e).done(() => {
|
||||
request.then(c, e).then(() => {
|
||||
if (!this.activeRequests) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ export class ChannelClient implements IChannelClient, IDisposable {
|
||||
|
||||
activeRequest
|
||||
.then(null, _ => null)
|
||||
.done(() => this.activeRequests = this.activeRequests.filter(el => el !== disposable));
|
||||
.then(() => this.activeRequests = this.activeRequests.filter(el => el !== disposable));
|
||||
|
||||
return activeRequest;
|
||||
}
|
||||
|
||||
Vendored
-4
@@ -53,10 +53,6 @@ declare namespace monaco {
|
||||
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
||||
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
||||
|
||||
public done(
|
||||
onfulfilled?: (value: T) => void,
|
||||
onrejected?: (reason: any) => void): void;
|
||||
|
||||
public cancel(): void;
|
||||
|
||||
public static as(value: null): Promise<null>;
|
||||
|
||||
@@ -37,6 +37,6 @@ export class ExtensionsManifestCache extends Disposable {
|
||||
}
|
||||
|
||||
invalidate(): void {
|
||||
pfs.del(this.extensionsManifestCache).done(() => { }, () => { });
|
||||
pfs.del(this.extensionsManifestCache).then(() => { }, () => { });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -714,7 +714,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
|
||||
return;
|
||||
}
|
||||
|
||||
return this.extensionsService.getInstalled(LocalExtensionType.User).done(local => {
|
||||
this.extensionsService.getInstalled(LocalExtensionType.User).then(local => {
|
||||
const recommendations = filteredRecs.filter(({ extensionId }) => local.every(local => !areSameExtensions({ id: extensionId }, { id: getGalleryExtensionIdFromLocal(local) })));
|
||||
|
||||
if (!recommendations.length) {
|
||||
|
||||
@@ -91,14 +91,6 @@ export class LazyPromise implements TPromise<any> {
|
||||
return this._ensureActual().then(success, error);
|
||||
}
|
||||
|
||||
public done(success: any, error: any): void {
|
||||
if (this._isCanceled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._ensureActual().done(success, error);
|
||||
}
|
||||
|
||||
public cancel(): void {
|
||||
if (this._hasValue || this._hasErr) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user