mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fire model view close event when destroyed (#1427)
This commit is contained in:
@@ -54,6 +54,11 @@ export class ModelViewContent extends ViewBase implements OnInit, IModelView {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this._onDestroy.fire();
|
||||||
|
super.ngOnDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
public layout(): void {
|
public layout(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ const componentRegistry = <IComponentRegistry>Registry.as(Extensions.ComponentCo
|
|||||||
export abstract class ViewBase extends AngularDisposable implements IModelView {
|
export abstract class ViewBase extends AngularDisposable implements IModelView {
|
||||||
protected readonly modelStore: IModelStore;
|
protected readonly modelStore: IModelStore;
|
||||||
protected rootDescriptor: IComponentDescriptor;
|
protected rootDescriptor: IComponentDescriptor;
|
||||||
|
protected _onDestroy = new Emitter<void>();
|
||||||
|
public readonly onDestroy = this._onDestroy.event;
|
||||||
constructor(protected changeRef: ChangeDetectorRef) {
|
constructor(protected changeRef: ChangeDetectorRef) {
|
||||||
super();
|
super();
|
||||||
this.modelStore = new ModelStore();
|
this.modelStore = new ModelStore();
|
||||||
|
|||||||
@@ -23,4 +23,5 @@ export interface IModelView extends IView {
|
|||||||
registerEvent(componentId: string);
|
registerEvent(componentId: string);
|
||||||
onEvent: Event<any>;
|
onEvent: Event<any>;
|
||||||
validate(componentId: string): Thenable<boolean>;
|
validate(componentId: string): Thenable<boolean>;
|
||||||
|
readonly onDestroy: Event<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export class MainThreadModelView extends Disposable implements MainThreadModelVi
|
|||||||
let handle = MainThreadModelView._handlePool++;
|
let handle = MainThreadModelView._handlePool++;
|
||||||
this._dialogs.set(handle, view);
|
this._dialogs.set(handle, view);
|
||||||
this._proxy.$registerWidget(handle, view.id, view.connection, view.serverInfo);
|
this._proxy.$registerWidget(handle, view.id, view.connection, view.serverInfo);
|
||||||
|
view.onDestroy(() => this._proxy.$onClosed(handle));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user