From dfb9a94140d819da1adde7fc5001a69c4477a2a6 Mon Sep 17 00:00:00 2001 From: joshuawilson Date: Wed, 27 Jun 2018 22:06:38 -0400 Subject: [PATCH] fix(build): remove unused Config.store and Val.wrapper --- index.ts | 6 ------ src/app/config.store.ts | 46 ----------------------------------------- src/app/val-wrapper.ts | 22 -------------------- 3 files changed, 74 deletions(-) delete mode 100644 src/app/config.store.ts delete mode 100644 src/app/val-wrapper.ts diff --git a/index.ts b/index.ts index 02dceb7..c022bd7 100644 --- a/index.ts +++ b/index.ts @@ -9,9 +9,3 @@ export { Broadcaster } from './src/app/broadcaster.service'; // Logger export { Logger } from './src/app/logger.service'; - -// Config -export { ConfigStore } from './src/app/config.store'; - -// ValWrapper -export { ValWrapper } from './src/app/val-wrapper'; diff --git a/src/app/config.store.ts b/src/app/config.store.ts deleted file mode 100644 index cf7632b..0000000 --- a/src/app/config.store.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Http } from '@angular/http'; - -import { Observable } from 'rxjs/Observable'; - -import { ValWrapper } from './val-wrapper'; - -export interface LoadCallback { - (json: any): T; -} - -@Injectable() -export class ConfigStore { - - private _cache: Map>> = new Map(); - - constructor( - private http: Http - ) { } - - get(name: string, load?: LoadCallback): Observable> { - if (this._cache.has(name)) { - return this._cache - .get(name); - } else { - let res = this.http - .get(`/_config/${name}.config.json`) - .map(resp => resp.json()) - .map(json => { - return { - val: (json as any), - loading: false - } as ValWrapper; - }) - .do(config => console.log('Config loaded', config)) - .publishReplay(1); - this._cache.set(name, res); - res.connect(); - return res; - } - } - - clear() { - this._cache = new Map(); - } -} diff --git a/src/app/val-wrapper.ts b/src/app/val-wrapper.ts deleted file mode 100644 index 3b18edf..0000000 --- a/src/app/val-wrapper.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A simple wrapper around a value which can be returned to provide - * useful information such as that the result is currently loading. - * - * This is particularly useful with RXJS as it allows you to emit - * an object from a stream. - */ -export class ValWrapper { - - /** - * The value - */ - val: T; - - /** - * An optional property. If set to true, it indicates that the - * val is currently being loaded. This can be used to handle streams - * that take a long time to return and, for example, display a spinner. - */ - loading?: boolean; - -}