aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/common/core/canDactivate/ComponentCanDeactivate.ts
blob: e0dac0dc371594689c81ed15a9535ae266e1ca3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import {HostListener} from '@angular/core';

export abstract class ComponentCanDeactivate {

    abstract canDeactivate(): boolean;


    @HostListener('window:beforeunload', ['$event'])
    unloadNotification($event: any) {
        if (!this.canDeactivate()) {
            $event.returnValue = true;
        }
    }
}