Переглянути джерело

Renames isReady to ready

main
Eric Amodio 1 рік тому
джерело
коміт
ee1e5214a8
7 змінених файлів з 35 додано та 35 видалено
  1. +12
    -12
      src/plus/webviews/graph/graphWebview.ts
  2. +2
    -2
      src/plus/webviews/timeline/timelineWebview.ts
  3. +2
    -2
      src/webviews/commitDetails/commitDetailsWebview.ts
  4. +4
    -4
      src/webviews/home/homeWebview.ts
  5. +1
    -1
      src/webviews/settings/settingsWebview.ts
  6. +12
    -12
      src/webviews/webviewController.ts
  7. +2
    -2
      src/webviews/webviewsController.ts

+ 12
- 12
src/plus/webviews/graph/graphWebview.ts Переглянути файл

@ -189,7 +189,7 @@ export class GraphWebviewProvider implements WebviewProvider {
this.resetRepositoryState();
this.ensureRepositorySubscriptions(true);
if (this.host.isReady) {
if (this.host.ready) {
this.updateState();
}
}
@ -282,7 +282,7 @@ export class GraphWebviewProvider implements WebviewProvider {
this.repository = context.node.repo;
}
if (this.repository != null && !loading && this.host.isReady) {
if (this.repository != null && !loading && this.host.ready) {
this.updateState();
}
}
@ -414,7 +414,7 @@ export class GraphWebviewProvider implements WebviewProvider {
}
if (visible) {
if (this.host.isReady) {
if (this.host.ready) {
this.sendPendingIpcNotifications();
}
@ -1117,7 +1117,7 @@ export class GraphWebviewProvider implements WebviewProvider {
@debug()
private async notifyDidChangeWindowFocus(): Promise<boolean> {
if (!this.host.isReady || !this.host.visible) {
if (!this.host.ready || !this.host.visible) {
this.addPendingIpcNotification(DidChangeWindowFocusNotificationType);
return false;
}
@ -1181,7 +1181,7 @@ export class GraphWebviewProvider implements WebviewProvider {
@debug()
private async notifyDidChangeColumns() {
if (!this.host.isReady || !this.host.visible) {
if (!this.host.ready || !this.host.visible) {
this.addPendingIpcNotification(DidChangeColumnsNotificationType);
return false;
}
@ -1196,7 +1196,7 @@ export class GraphWebviewProvider implements WebviewProvider {
@debug()
private async notifyDidChangeRefsVisibility() {
if (!this.host.isReady || !this.host.visible) {
if (!this.host.ready || !this.host.visible) {
this.addPendingIpcNotification(DidChangeRefsVisibilityNotificationType);
return false;
}
@ -1210,7 +1210,7 @@ export class GraphWebviewProvider implements WebviewProvider {
@debug()
private async notifyDidChangeConfiguration() {
if (!this.host.isReady || !this.host.visible) {
if (!this.host.ready || !this.host.visible) {
this.addPendingIpcNotification(DidChangeGraphConfigurationNotificationType);
return false;
}
@ -1222,7 +1222,7 @@ export class GraphWebviewProvider implements WebviewProvider {
@debug()
private async notifyDidFetch() {
if (!this.host.isReady || !this.host.visible) {
if (!this.host.ready || !this.host.visible) {
this.addPendingIpcNotification(DidFetchNotificationType);
return false;
}
@ -1257,7 +1257,7 @@ export class GraphWebviewProvider implements WebviewProvider {
@debug()
private async notifyDidChangeWorkingTree() {
if (!this.host.isReady || !this.host.visible) {
if (!this.host.ready || !this.host.visible) {
this.addPendingIpcNotification(DidChangeWorkingTreeNotificationType);
return false;
}
@ -1269,7 +1269,7 @@ export class GraphWebviewProvider implements WebviewProvider {
@debug()
private async notifyDidChangeSelection() {
if (!this.host.isReady || !this.host.visible) {
if (!this.host.ready || !this.host.visible) {
this.addPendingIpcNotification(DidChangeSelectionNotificationType);
return false;
}
@ -1281,7 +1281,7 @@ export class GraphWebviewProvider implements WebviewProvider {
@debug()
private async notifyDidChangeSubscription() {
if (!this.host.isReady || !this.host.visible) {
if (!this.host.ready || !this.host.visible) {
this.addPendingIpcNotification(DidChangeSubscriptionNotificationType);
return false;
}
@ -1295,7 +1295,7 @@ export class GraphWebviewProvider implements WebviewProvider {
@debug()
private async notifyDidChangeState() {
if (!this.host.isReady || !this.host.visible) {
if (!this.host.ready || !this.host.visible) {
this.addPendingIpcNotification(DidChangeNotificationType);
return false;
}

+ 2
- 2
src/plus/webviews/timeline/timelineWebview.ts Переглянути файл

@ -396,7 +396,7 @@ export class TimelineWebviewProvider implements WebviewProvider {
@debug()
private updateState(immediate: boolean = false) {
if (!this.host.isReady || !this.host.visible) return;
if (!this.host.ready || !this.host.visible) return;
if (this._pendingContext == null && this.host.isView()) {
this.updatePendingEditor(window.activeTextEditor);
@ -416,7 +416,7 @@ export class TimelineWebviewProvider implements WebviewProvider {
@debug()
private async notifyDidChangeState() {
if (!this.host.isReady || !this.host.visible) return false;
if (!this.host.ready || !this.host.visible) return false;
this._notifyDidChangeStateDebounced?.cancel();
if (this._pendingContext == null) return false;

+ 2
- 2
src/webviews/commitDetails/commitDetailsWebview.ts Переглянути файл

@ -674,7 +674,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
private _notifyDidChangeStateDebounced: Deferrable<() => void> | undefined = undefined;
private updateState(immediate: boolean = false) {
if (!this.host.isReady || !this.host.visible) return;
if (!this.host.ready || !this.host.visible) return;
if (immediate) {
void this.notifyDidChangeState();
@ -689,7 +689,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
}
private async notifyDidChangeState() {
if (!this.host.isReady || !this.host.visible) return false;
if (!this.host.ready || !this.host.visible) return false;
const scope = getLogScope();

+ 4
- 4
src/webviews/home/homeWebview.ts Переглянути файл

@ -239,7 +239,7 @@ export class HomeWebviewProvider implements WebviewProvider {
}
private notifyDidChangeData(subscription?: Subscription) {
if (!this.host.isReady) return false;
if (!this.host.ready) return false;
return window.withProgress({ location: { viewId: this.host.id } }, async () => {
const sub = await this.getSubscription(subscription);
@ -255,7 +255,7 @@ export class HomeWebviewProvider implements WebviewProvider {
}
private notifyExtensionEnabled() {
if (!this.host.isReady) return;
if (!this.host.ready) return;
void this.host.notify(DidChangeExtensionEnabledType, {
extensionEnabled: this.getExtensionEnabled(),
@ -267,7 +267,7 @@ export class HomeWebviewProvider implements WebviewProvider {
}
private notifyDidChangeConfiguration() {
if (!this.host.isReady) return;
if (!this.host.ready) return;
void this.host.notify(DidChangeConfigurationType, {
plusEnabled: this.getPlusEnabled(),
@ -280,7 +280,7 @@ export class HomeWebviewProvider implements WebviewProvider {
}
private notifyDidChangeLayout() {
if (!this.host.isReady) return;
if (!this.host.ready) return;
void this.host.notify(DidChangeLayoutType, { layout: this.getLayout() });
}

+ 1
- 1
src/webviews/settings/settingsWebview.ts Переглянути файл

@ -16,7 +16,7 @@ export class SettingsWebviewProvider extends WebviewProviderWithConfigBase
): boolean | Promise<boolean> {
const anchor = args[0];
if (anchor && typeof anchor === 'string') {
if (!loading && this.host.isReady && this.host.visible) {
if (!loading && this.host.ready && this.host.visible) {
queueMicrotask(
() =>
void this.host.notify(DidOpenAnchorNotificationType, {

+ 12
- 12
src/webviews/webviewController.ts Переглянути файл

@ -123,10 +123,10 @@ export class WebviewController<
public readonly id: Descriptor['id'];
private _isReady: boolean = false;
private _ready: boolean = false;
private _suspended: boolean = false;
get isReady() {
return this._isReady;
get ready() {
return this._ready;
}
private readonly disposables: Disposable[] = [];
@ -171,7 +171,7 @@ export class WebviewController<
this.provider.onFocusChanged?.(false);
this.provider.onVisibilityChanged?.(false);
this._isReady = false;
this._ready = false;
this._suspended = false;
this._onDidDispose.fire();
@ -271,7 +271,7 @@ export class WebviewController<
this.provider.onRefresh?.(force);
// Mark the webview as not ready, until we know if we are changing the html
this._isReady = false;
this._ready = false;
this._suspended = false;
const html = await this.getHtml(this.webview);
@ -282,7 +282,7 @@ export class WebviewController<
// If we aren't changing the html, mark the webview as ready again
if (this.webview.html === html) {
this._isReady = true;
this._ready = true;
return;
}
@ -302,7 +302,7 @@ export class WebviewController<
switch (e.method) {
case WebviewReadyCommandType.method:
onIpc(WebviewReadyCommandType, e, () => {
this._isReady = true;
this._ready = true;
this._suspended = false;
this.provider.onReady?.();
});
@ -349,12 +349,12 @@ export class WebviewController<
if (this.descriptor.webviewHostOptions?.retainContextWhenHidden !== true) {
if (visible) {
if (this._suspended) {
this._isReady = true;
this._ready = true;
this._suspended = false;
this.provider.onReady?.();
}
} else {
this._isReady = false;
this._ready = false;
this._suspended = true;
}
}
@ -380,12 +380,12 @@ export class WebviewController<
if (this.descriptor.webviewHostOptions?.retainContextWhenHidden !== true) {
if (visible) {
if (this._suspended) {
this._isReady = true;
this._ready = true;
this._suspended = false;
this.provider.onReady?.();
}
} else {
this._isReady = false;
this._ready = false;
this._suspended = true;
}
}
@ -476,7 +476,7 @@ export class WebviewController<
},
})
async postMessage(message: IpcMessage): Promise<boolean> {
if (!this._isReady) return Promise.resolve(false);
if (!this._ready) return Promise.resolve(false);
// It looks like there is a bug where `postMessage` can sometimes just hang infinitely. Not sure why, but ensure we don't hang
const success = await Promise.race<boolean>([

+ 2
- 2
src/webviews/webviewsController.ts Переглянути файл

@ -151,7 +151,7 @@ export class WebviewsController implements Disposable {
return {
id: descriptor.id,
get ready() {
return registration.controller?.isReady ?? false;
return registration.controller?.ready ?? false;
},
get visible() {
return registration.controller?.visible ?? false;
@ -246,7 +246,7 @@ export class WebviewsController implements Disposable {
return {
id: descriptor.id,
get ready() {
return registration.controller?.isReady ?? false;
return registration.controller?.ready ?? false;
},
get visible() {
return registration.controller?.visible ?? false;

Завантаження…
Відмінити
Зберегти