Overview | Workbench | Workbench Application Platform | Contributing | Changelog | Sponsoring | Links |
---|
In the view component, implement WbBeforeDestroy
lifecycle hook. It is called when the component is about to be destroyed.
@Component({
...
providers: [provideWorkbenchView(ViewComponent)]
})
export class ViewComponent implements WbBeforeDestroy {
public wbBeforeDestroy(): Observable<boolean> | Promise<boolean> | boolean {
// e.g., ask the user to close the view
}
}
For non Angular applications, register a function via ViewService
.
Platform.getService(ViewService).setDestroyNotifier(() => Observable<boolean> | Promise<boolean> | boolean {
// e.g., ask the user to close the view
});