type Callback = ( ok : boolean ) => void ; export class ConfirmBeforeLeavePage { private static confirmHandler : null | ( ( cb : Callback ) => void ) = null ; static register = ( handler ) => { ConfirmBeforeLeavePage . confirmHandler = handler ; } ; static unregister = ( ) => { ConfirmBeforeLeavePage . confirmHandler = null ; } ; static confirmBeforeLeave = ( message , callback ) => { if ( ConfirmBeforeLeavePage . confirmHandler ) ConfirmBeforeLeavePage . confirmHandler ( callback ) ; } ; }