Adding Comments

Adding Possiblity to generate a Documentation

Signed-off-by: Martin Karkowski <m.karkowski@dozema.local>
This commit is contained in:
Martin Karkowski 2020-09-11 09:36:14 +02:00
parent 510eb7fdfa
commit 27e5f5569b
5 changed files with 825 additions and 35 deletions

2
.gitignore vendored
View File

@ -104,3 +104,5 @@ temp
# TernJS port file
.tern-port
config/
docs

17
jsdoc.json Normal file
View File

@ -0,0 +1,17 @@
{
"tags": {
"allowUnknownTags": [
"optional"
]
},
"plugins": [
"node_modules/better-docs/typescript"
],
"source": {
"includePattern": "\\.(ts|tsx)$"
},
"opts": {
"destination": "./docs/",
"recurse": true
}
}

View File

@ -3,6 +3,17 @@ import { nopeDispatcher } from "../dispatcher/nopeDispatcher";
export type pipe<T, K> = (scope: { [index: string]: any }, observable: Observable<T>) => Observable<K>
/**
* A Remote Observable.
* This function acts a wrapper to access a Remote-Observable.
* The wrapper can be used to manipulate the item.
*
* @export
* @class nopeRemoteObservable
* @template T
* @template S
* @template G
*/
export class nopeRemoteObservable<T, S = T, G = T> {
protected _pathes: {
get: string,
@ -29,14 +40,33 @@ export class nopeRemoteObservable<T, S = T, G = T> {
}
}
/**
* Currently used remote Value.
*
* @readonly
* @memberof nopeRemoteObservable
*/
public get currentRemoteValue() {
return this.getRemoteValue()
}
/**
* Manually Funciton for getting the Remote Value.
*
* @return {*}
* @memberof nopeRemoteObservable
*/
public async getRemoteValue() {
return await this._dispatcher.performCall<G>(this._pathes.get, [])
}
/**
* Updates the Remote Value. (This will although trigger a Subscription update)
*
* @param {S} value The Value to use
* @return {*} Function doesnt return something
* @memberof nopeRemoteObservable
*/
public async setRemoteValue(value: S) {
// Perform an Update.
return await this._dispatcher.performCall<void>(this._pathes.set, [value]);
@ -44,8 +74,15 @@ export class nopeRemoteObservable<T, S = T, G = T> {
/**
* Function to Subscribe a NopeObservable on a Remote.
* @param next the callback, which will be called on new Data.
* @param options
*
* @template K
* @param {(data: K) => void} next the callback, which will be called on new Data.
* @param {{
* scope?: { [index: string]: any },
* pipe?: pipe<G, K>
* }} [options={}] Options to enhance the Subscription. You can provide a Pipe. This pipe will be executed on the remote to reduce networktraffic.
* @return {*}
* @memberof nopeRemoteObservable
*/
public async subscribe<K>(next: (data: K) => void, options: {
scope?: { [index: string]: any },

791
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@
"test": "echo \"Error: no test specified\" && exit 1",
"generate-frontend-interfaces": "openapi --input http://localhost:3000/api/api-docs --output ./pages/interfaces",
"compile-backend": "tsc -p ./tsconfigBackend.json",
"doc": "npx jsdoc ./lib -r -c jsdoc.json",
"dev": "next dev",
"build": "next build",
"start": "next start"
@ -56,7 +57,6 @@
"socket.io-client": "^2.3.0",
"swagger-ui-react": "^3.32.5",
"ts-morph": "^8.1.0",
"typescript-json-schema": "^0.43.0",
"uuid": "^8.3.0",
"winston": "^3.3.3"
},
@ -68,8 +68,11 @@
"@types/react": "^16.9.49",
"@types/socket.io": "^2.1.11",
"@types/socket.io-client": "^1.4.33",
"better-docs": "^2.3.2",
"jsdocs": "^1.0.0",
"npm-check-updates": "^8.1.1",
"openapi-typescript-codegen": "^0.4.11",
"typescript": "^4.0.2"
"typescript": "^4.0.2",
"typescript-json-schema": "^0.43.0"
}
}
}