import { WindowStateChangedEvent } from './ow-types' ; export interface OWWindowsListenerDelegate { onStateChange ( event ) : void ; } export class OWWindowsListener { constructor ( private readonly delegate ) { } public start ( ) { this . unregisterEvents ( ) ; this . registerEvents ( ) ; } public stop ( ) { this . unregisterEvents ( ) ; } private onStateChange = ( event ) : void => { this . delegate . onStateChange ( event ) ; } ; private registerEvents ( ) { overwolf . windows . onStateChanged . addListener ( this . onStateChange ) ; } private unregisterEvents ( ) { overwolf . windows . onStateChanged . removeListener ( this . onStateChange ) ; } }