import { AppManagerDriver } from './app-manager-driver' ; import { App } from './../app' ; export class ArrayAppManager implements AppManagerDriver { param { any } options constructor ( protected options ) { } param { string } id param { any } socket param { any } data return { Promise < App | null > } findById ( id , socket , data ) { return new Promise ( ( resolve , reject ) => { let app = this . options . appManager . array . apps . find ( app => app . id === id ) ; if ( typeof app !== 'undefined' ) { resolve ( new App ( app ) ) ; } else { reject ( { reason : `App ${ id } not found.` } ) ; } } ) ; } param { string } key param { any } socket param { any } data return { Promise < App | null > } findByKey ( key , socket , data ) { return new Promise ( ( resolve , reject ) => { let app = this . options . appManager . array . apps . find ( app => app . key === key ) ; if ( typeof app !== 'undefined' ) { resolve ( new App ( app ) ) ; } else { reject ( { reason : `App ${ key } not found.` } ) ; } } ) ; } }