import * as IScheme from './service.window.state.scheme' ; import { StateFile } from '../classes/class.statefile' ; import { IService } from '../interfaces/interface.service' ; const SETTINGS_FILE = 'config.window.json' ; class description class ServiceWindowState implements IService { private _settings : StateFile < IScheme . IWindowState > | undefined ; public init ( ) { return new Promise ( ( resolve , reject ) => { this . _settings = new StateFile < IScheme . IWindowState > ( this . getName ( ) , IScheme . defaults , SETTINGS_FILE ) ; this . _settings . init ( ) . then ( ( ) => { resolve ( ) ; } ) . catch ( reject ) ; } ) ; } public destroy ( ) { return new Promise ( ( resolve ) => { if ( this . _settings === undefined ) { return resolve ( ) ; } this . _settings . destroy ( ) . then ( resolve ) ; } ) ; } public getName ( ) { return 'ServiceWindowState' ; } public getSettings ( ) { return this . _settings as StateFile < IScheme . IWindowState > ; } } export default ( new ServiceWindowState ( ) ) ;