summaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/common/core/canDactivate/ComponentCanDeactivate.ts
blob: 3435b10d318c598e8b216da39ed442b416c7bc6d (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;
        }
    }
}