diff --git a/.gitignore b/.gitignore index 0399599..0a93c4d 100644 --- a/.gitignore +++ b/.gitignore @@ -104,4 +104,3 @@ temp # TernJS port file .tern-port config/ -backend-api/ diff --git a/lib/helpers/generateTemplate.ts b/lib/helpers/generateTemplate.ts index eeca3cd..30a93d5 100644 --- a/lib/helpers/generateTemplate.ts +++ b/lib/helpers/generateTemplate.ts @@ -35,11 +35,11 @@ export async function generateClientTemplate(options: { path: ['dispatcher'], src: ['lib', 'dispatcher'] }, - { - name: 'nopeObservable.ts', - path: ['observables'], - src: ['lib', 'observables'] - }, + // { + // name: 'nopeObservable.ts', + // path: ['observables'], + // src: ['lib', 'observables'] + // }, { name: 'nopeRemoteObservable.ts', path: ['observables'], diff --git a/lib/observables/nopeRemoteObservable.ts b/lib/observables/nopeRemoteObservable.ts index f5314f2..aa07a57 100644 --- a/lib/observables/nopeRemoteObservable.ts +++ b/lib/observables/nopeRemoteObservable.ts @@ -1,32 +1,15 @@ +import { Observable } from 'rxjs'; import { nopeDispatcher } from "../dispatcher/nopeDispatcher"; -import { pipe } from "./nopeObservable"; +export type pipe = (scope: { [index: string]: any }, observable: Observable) => Observable -export class nopeRemoteObservable { - protected _currentLocalValue: T; +export class nopeRemoteObservable { protected _pathes: { get: string, set: string, subscribe: string, } - /** - * Getter for the Current Value. - */ - public get currentLocalValue(): T { - return this._currentLocalValue; - } - - /** - * Setter for the Current value. - */ - public set currentLocalValue(value: T) { - this.setRemoteValue(value).catch(e => { - // Catch the Error an rethrow it. - throw e; - }); - } - /** * Creates a Remote Dispatcher. * @param _dispatcher @@ -46,14 +29,12 @@ export class nopeRemoteObservable { } public async getRemoteValue() { - return await this._dispatcher.performCall(this._pathes.get, []) + return await this._dispatcher.performCall(this._pathes.get, []) } - public async setRemoteValue(value: T) { - // Update the Local Value as Well - this._currentLocalValue = value; + public async setRemoteValue(value: S) { // Perform an Update. - return await this._dispatcher.performCall(this._pathes.set, [value]); + return await this._dispatcher.performCall(this._pathes.set, [value]); } /** @@ -63,7 +44,7 @@ export class nopeRemoteObservable { */ public async subscribe(next: (data: K) => void, options: { scope?: { [index: string]: any }, - pipe?: pipe + pipe?: pipe } = {}) { return await this._dispatcher.performCall<() => void>(this._pathes.subscribe, [next, options]); } diff --git a/nopeconfig.json b/nopeconfig.json index 72082ee..694e990 100644 --- a/nopeconfig.json +++ b/nopeconfig.json @@ -1,7 +1,7 @@ { "dispatcher": { "inputDir": "./test/*.ts", - "outputDir": "./backend-api", + "outputDir": "./resources/backend-api", "pathToClientTemplate": "./lib/templates/clientInterface.handlebars", "pathToInterfaceTemplate": "./lib/templates/backendInterface.handlebars", "tsConfigFilePath": "./tsconfigBackend.json" diff --git a/resources/.gitignore b/resources/.gitignore new file mode 100644 index 0000000..99f0b47 --- /dev/null +++ b/resources/.gitignore @@ -0,0 +1 @@ +backend-api \ No newline at end of file