adding wiki
This commit is contained in:
parent
08dfc238af
commit
ba9f7e5c17
@ -1 +1 @@
|
|||||||
1.0.9
|
1.0.10
|
@ -1,3 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* @author Martin Karkowski
|
||||||
|
* @email m.karkowski@zema.de
|
||||||
|
* @create date 2022-01-18 13:42:41
|
||||||
|
* @modify date 2022-01-18 13:42:43
|
||||||
|
* @desc [description]
|
||||||
|
*/
|
||||||
|
|
||||||
const { readFileSync, writeFileSync } = require("fs");
|
const { readFileSync, writeFileSync } = require("fs");
|
||||||
|
|
||||||
const version = readFileSync("./contribute/VERSION", { encoding: "utf-8" });
|
const version = readFileSync("./contribute/VERSION", { encoding: "utf-8" });
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* @author Martin Karkowski
|
||||||
|
* @email m.karkowski@zema.de
|
||||||
|
* @create date 2022-01-18 13:42:45
|
||||||
|
* @modify date 2022-01-18 13:42:48
|
||||||
|
* @desc [description]
|
||||||
|
*/
|
||||||
|
|
||||||
const { readFileSync, writeFileSync } = require("fs");
|
const { readFileSync, writeFileSync } = require("fs");
|
||||||
|
|
||||||
const version = readFileSync("./contribute/VERSION", { encoding: "utf-8" });
|
const version = readFileSync("./contribute/VERSION", { encoding: "utf-8" });
|
||||||
|
@ -10,4 +10,3 @@
|
|||||||
export * from "./index.browser";
|
export * from "./index.browser";
|
||||||
export { files };
|
export { files };
|
||||||
import * as files from "./fileMethods";
|
import * as files from "./fileMethods";
|
||||||
|
|
||||||
|
@ -17,7 +17,10 @@
|
|||||||
* @param {() => T} create The Callback which is used to create the instance.
|
* @param {() => T} create The Callback which is used to create the instance.
|
||||||
* @return An object, containing the key **instances**, where you'll find the instance and an helper function **setInstance** to redefine the instance
|
* @return An object, containing the key **instances**, where you'll find the instance and an helper function **setInstance** to redefine the instance
|
||||||
*/
|
*/
|
||||||
export function getSingleton<T>(identifier: string, create: () => T): {
|
export function getSingleton<T>(
|
||||||
|
identifier: string,
|
||||||
|
create: () => T
|
||||||
|
): {
|
||||||
instance: T;
|
instance: T;
|
||||||
setInstance: (value: T) => void;
|
setInstance: (value: T) => void;
|
||||||
} {
|
} {
|
||||||
|
@ -17,6 +17,7 @@ import * as observables from "./observables/index";
|
|||||||
import * as promises from "./promise/index";
|
import * as promises from "./promise/index";
|
||||||
import * as types from "./types/index";
|
import * as types from "./types/index";
|
||||||
|
|
||||||
|
export { getLayer } from "./communication/index.browser";
|
||||||
export * from "./logger/index.browser";
|
export * from "./logger/index.browser";
|
||||||
export {
|
export {
|
||||||
communcation,
|
communcation,
|
||||||
|
@ -21,6 +21,7 @@ export {
|
|||||||
readInArgs as readInRunNopeBackendArgs,
|
readInArgs as readInRunNopeBackendArgs,
|
||||||
runNopeBackend,
|
runNopeBackend,
|
||||||
} from "./cli/runNopeBackend";
|
} from "./cli/runNopeBackend";
|
||||||
|
export { getLayer } from "./communication/index.nodejs";
|
||||||
export * from "./logger/index.nodejs";
|
export * from "./logger/index.nodejs";
|
||||||
export {
|
export {
|
||||||
communcation,
|
communcation,
|
||||||
|
@ -51,14 +51,13 @@ export {
|
|||||||
getLogerAsEventEmitter,
|
getLogerAsEventEmitter,
|
||||||
TCallback,
|
TCallback,
|
||||||
TCallbackWithLevel,
|
TCallbackWithLevel,
|
||||||
useEventLogger
|
useEventLogger,
|
||||||
} from "./eventLogging";
|
} from "./eventLogging";
|
||||||
export {
|
export {
|
||||||
defineNopeLogger,
|
defineNopeLogger,
|
||||||
getCentralNopeLogger,
|
getCentralNopeLogger,
|
||||||
getNopeLogger,
|
getNopeLogger,
|
||||||
ValidLoggerDefinition
|
ValidLoggerDefinition,
|
||||||
} from "./getLogger";
|
} from "./getLogger";
|
||||||
export { LoggerLevel, LoggerLevels } from "./nopeLogger";
|
export { LoggerLevel, LoggerLevels } from "./nopeLogger";
|
||||||
export { setGlobalLoggerLevel } from "./setGlobalLoggerLevel";
|
export { setGlobalLoggerLevel } from "./setGlobalLoggerLevel";
|
||||||
|
|
||||||
|
@ -5,9 +5,8 @@
|
|||||||
* @modify date 2021-08-27 20:19:05
|
* @modify date 2021-08-27 20:19:05
|
||||||
* @desc [description]
|
* @desc [description]
|
||||||
* @module logger
|
* @module logger
|
||||||
* [[include lib/logger/README.md]]
|
* [[include:00-Getting-Started.md]]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export { generateLogfilePath, useLogFile } from "./fileLogging";
|
export { generateLogfilePath, useLogFile } from "./fileLogging";
|
||||||
export * from "./index.browser";
|
export * from "./index.browser";
|
||||||
|
|
||||||
|
@ -11,14 +11,14 @@ import { ICommunicationBridge } from "./nopeCommunication.interface";
|
|||||||
import {
|
import {
|
||||||
IHost,
|
IHost,
|
||||||
INopeINopeConnectivityTimeOptions,
|
INopeINopeConnectivityTimeOptions,
|
||||||
INopeStatusInfo,
|
INopeStatusInfo
|
||||||
} from "./nopeConnectivityManager.interface";
|
} from "./nopeConnectivityManager.interface";
|
||||||
import { INopeCore } from "./nopeCore.interface";
|
import { INopeCore } from "./nopeCore.interface";
|
||||||
import { INopeDescriptor } from "./nopeDescriptor.interface";
|
import { INopeDescriptor } from "./nopeDescriptor.interface";
|
||||||
import {
|
import {
|
||||||
IEventAdditionalData,
|
IEventAdditionalData,
|
||||||
IEventCallback,
|
IEventCallback,
|
||||||
INopeObserver,
|
INopeObserver
|
||||||
} from "./nopeEventEmitter.interface";
|
} from "./nopeEventEmitter.interface";
|
||||||
import { INopeModule, INopeModuleDescription } from "./nopeModule.interface";
|
import { INopeModule, INopeModuleDescription } from "./nopeModule.interface";
|
||||||
import { INopeObservable } from "./nopeObservable.interface";
|
import { INopeObservable } from "./nopeObservable.interface";
|
||||||
@ -142,8 +142,19 @@ export interface INopeDispatcherDescription extends INopeStatusInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for an Dispatcher.
|
* # NoPE - Dispatcher
|
||||||
*
|
*
|
||||||
|
* The NoPE-Dispatcher is designed as Layer between the different Modules / Dispatchers. They allow distributed computing or just a simple ***Service oriented Architecture*** (*SOA*). A dispatcher is used to link the modules, share data and events and provide a remote procedure call (rpc) interface.
|
||||||
|
*
|
||||||
|
* ## Building Blocks of a Dispatcher:
|
||||||
|
*
|
||||||
|
* | element | description |
|
||||||
|
* |-|-|
|
||||||
|
* | `connectivityManager` | establishes a connection to other dispatchers and manages the status of the remotely connected dispatchers. It checks their health and removes dead dispatchers. |
|
||||||
|
* | `eventDistributor` | shares events accross the network (or internally). You can use this element to listen for specific events. The subscription to those events allows `mqtt`-patterns. Additionaly, you are allowed to emit event on specific topics, or pattern based topics |
|
||||||
|
* | `dataDistributor` | shares data accross the network (or internally). In comperisson to events, data is persistent and is available all the time. You can use this sub-module to listen for specific data-changes (install data-hooks), pull specific data or push data. You can pull / push data using a `mqtt`-pattern based path. |
|
||||||
|
* | `rpcManager` | Used to perform `remote procedure calls` (see [here](https://de.wikipedia.org/wiki/Remote_Procedure_Call)). The manager keeps track of the available services. You must use the sub-module to register/unregister (new) services. |
|
||||||
|
* | `instanceManager` | Used to create/dispose (remote) instances. The manager keeps track of the available instances in the network, allows to create `wrappers` for those instances. You must use the sub-module to register/unregister (new) instances. To allow the system to provide a service for creating instances of as specific type, you can provide a generator and provide it as `service`. |
|
||||||
* @export
|
* @export
|
||||||
* @interface INopeDispatcher
|
* @interface INopeDispatcher
|
||||||
*/
|
*/
|
||||||
|
11
package-lock.json
generated
11
package-lock.json
generated
@ -1,14 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "nope",
|
"name": "nope",
|
||||||
"version": "1.0.9",
|
"version": "1.0.10",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nope",
|
"name": "nope",
|
||||||
"version": "1.0.9",
|
"version": "1.0.10",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"argparse": "^2.0.1",
|
||||||
"async": "^3.2.2",
|
"async": "^3.2.2",
|
||||||
"comment-parser": "^1.3.0",
|
"comment-parser": "^1.3.0",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
@ -947,8 +948,7 @@
|
|||||||
"node_modules/argparse": {
|
"node_modules/argparse": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
|
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"node_modules/arr-diff": {
|
"node_modules/arr-diff": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
@ -18992,8 +18992,7 @@
|
|||||||
"argparse": {
|
"argparse": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
|
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"arr-diff": {
|
"arr-diff": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nope",
|
"name": "nope",
|
||||||
"version": "1.0.9",
|
"version": "1.0.10",
|
||||||
"description": "NoPE Runtime for Nodejs. For Browser-Support please use nope-browser",
|
"description": "NoPE Runtime for Nodejs. For Browser-Support please use nope-browser",
|
||||||
"files": [
|
"files": [
|
||||||
"dist-nodejs/**/*",
|
"dist-nodejs/**/*",
|
||||||
@ -39,6 +39,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://git.zema.de/tfs/ZISS/_git/nope-js#readme",
|
"homepage": "https://git.zema.de/tfs/ZISS/_git/nope-js#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"argparse": "^2.0.1",
|
||||||
"async": "^3.2.2",
|
"async": "^3.2.2",
|
||||||
"comment-parser": "^1.3.0",
|
"comment-parser": "^1.3.0",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
|
@ -30,9 +30,7 @@
|
|||||||
"location": "local",
|
"location": "local",
|
||||||
"format": "png"
|
"format": "png"
|
||||||
},
|
},
|
||||||
"includes": [
|
"includes": "wiki"
|
||||||
"lib"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"lib",
|
"lib",
|
||||||
|
1
wiki/.gitignore
vendored
Normal file
1
wiki/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.ipynb_checkpoints
|
@ -20,7 +20,16 @@ Use the following code: `npm --registry https://npm.zema.de/ install nope`
|
|||||||
|
|
||||||
The Documentation is contained in here. Alternative you can create a Documentation using `npm run-script doc`. This will create the Documentation under `docs`.
|
The Documentation is contained in here. Alternative you can create a Documentation using `npm run-script doc`. This will create the Documentation under `docs`.
|
||||||
|
|
||||||
You'll additional help under `wiki`
|
You'll additional help under `wiki`.
|
||||||
|
|
||||||
|
The `wiki` is mostly running as `Markdown` or `Jupyter`-Notebook.
|
||||||
|
|
||||||
|
### Run the wiki
|
||||||
|
|
||||||
|
1. Install the documents via: `00-install-jupyter.bat`
|
||||||
|
1. Install the `jupyter` with `pip3 install jupyter`
|
||||||
|
2. Install a Javascript interpreter for `jupyter` with `npm install -g ijavascript`. Afterwards install the extension `%appdata%\npm\ijsinstall`
|
||||||
|
2. Run the `01-start-jupyter.bat`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
7
wiki/01-NoPE.md
Normal file
7
wiki/01-NoPE.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
![Logo](./media/logo.png)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## No Programming Environment - `NoPE`
|
||||||
|
|
||||||
|
`NoPE`-Library for `javascript` / `python`.
|
24
wiki/02-Logging.ipynb
Normal file
24
wiki/02-Logging.ipynb
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "JavaScript (Node.js)",
|
||||||
|
"language": "javascript",
|
||||||
|
"name": "javascript"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"name": "javascript"
|
||||||
|
},
|
||||||
|
"orig_nbformat": 4
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
209
wiki/11-Observables.ipynb
Normal file
209
wiki/11-Observables.ipynb
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"# Observables\n",
|
||||||
|
"## Usage of `nope.observables`\n",
|
||||||
|
"\n",
|
||||||
|
"Import Nope.\n",
|
||||||
|
"\n",
|
||||||
|
"```typescript\n",
|
||||||
|
"import * as nope from \"nope\";\n",
|
||||||
|
"```\n",
|
||||||
|
"\n",
|
||||||
|
"In our nodebook, we have to use **javascript** instead of **typescript**:"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"// First lets install nope using npm\n",
|
||||||
|
"const nope = require(\"../dist-nodejs/index.nodejs\")\n",
|
||||||
|
"\n",
|
||||||
|
"// Create our Observable:\n",
|
||||||
|
"const obs = new nope.observables.NopeObservable()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### `setContent`: Change the content of the Observable.\n",
|
||||||
|
"\n",
|
||||||
|
"To change the content of an observable use the function `setContent`."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"// Set the content to \"1337\"\n",
|
||||||
|
"obs.setContent(5);\n",
|
||||||
|
"\n",
|
||||||
|
"// Print the content (see getContent)\n",
|
||||||
|
"console.log(\"current value =\",obs.getContent());"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"#### `setter`: Define a specific setter for the observable.\n",
|
||||||
|
"\n",
|
||||||
|
"You can specify a specifc getter for the observable for instance, to limit the number to the following constrains `> 0` and `< 10`.\n",
|
||||||
|
"\n",
|
||||||
|
"---\n",
|
||||||
|
"\n",
|
||||||
|
"The setter function will receive multiple parameters, as listed below:\n",
|
||||||
|
"\n",
|
||||||
|
"1. `value`,\n",
|
||||||
|
"2. ``options`` containing:\n",
|
||||||
|
" * `sender`: The Element, which changed the data\n",
|
||||||
|
" * `timestamp`: The timestamp of the change\n",
|
||||||
|
" * `args`: additional args. \n",
|
||||||
|
"\n",
|
||||||
|
"---\n",
|
||||||
|
"\n",
|
||||||
|
"The setter function have to return a `dict` with the following keys:\n",
|
||||||
|
"| key | type | content |\n",
|
||||||
|
"| - | - | - |\n",
|
||||||
|
"| `valid` | `bool` | A Flag, to show whether the data are valid or not. If the data is invalid, the observable wont store them |\n",
|
||||||
|
"| `value` | `any` | The Data that has been adapted |\n",
|
||||||
|
"\n",
|
||||||
|
"---\n",
|
||||||
|
"\n",
|
||||||
|
"Below, we will implement an example to show the setter above."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"obs.setter = (value, options) => {\n",
|
||||||
|
" // Print, which data we received\n",
|
||||||
|
" console.log(\"setter received\", value, options);\n",
|
||||||
|
" // Show the result of our comparison\n",
|
||||||
|
" console.log(\"data is valid:\", (value > 0) && (value < 10));\n",
|
||||||
|
" return {\n",
|
||||||
|
" // The Value\n",
|
||||||
|
" value: value,\n",
|
||||||
|
" // Valid\n",
|
||||||
|
" valid: (value > 0) && (value < 10)\n",
|
||||||
|
" }\n",
|
||||||
|
"}\n",
|
||||||
|
"\n",
|
||||||
|
"// Set the content to \"1337\" ==> But our setter will prevent using this value because it isnt valid.\n",
|
||||||
|
"obs.setContent(1337);\n",
|
||||||
|
"\n",
|
||||||
|
"// Print the content (see getContent) ==> we expect to get \"5\"\n",
|
||||||
|
"console.log(\"current value =\", obs.getContent());"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"To remove such a getter just set the getter property to `null`."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"obs.setter = null\n",
|
||||||
|
"\n",
|
||||||
|
"// Set the content to \"1337\" we do not have any setter ==> we will use this parameter\n",
|
||||||
|
"obs.setContent(1337);\n",
|
||||||
|
"\n",
|
||||||
|
"// Print the content (see getContent) ==> we expect to get \"1337\"\n",
|
||||||
|
"console.log(\"current value =\", obs.getContent());"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### `getContent`: Get the current content of the Observable.\n",
|
||||||
|
"To extract the content of our observable, we are able to use the function `getContent`"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"let content = obs.getContent();\n",
|
||||||
|
"console.log(\"current value =\", content)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"If no data is assigned, this will result in `undefined`. Otherwise the current data is returned.\n",
|
||||||
|
"\n",
|
||||||
|
"#### `getter`: Define a specific getter for the observable.\n",
|
||||||
|
"\n",
|
||||||
|
"You can specify a specifc getter for the observable for instance, to allways return a `string`"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"// Define a getter\n",
|
||||||
|
"obs.getter = (value) => \"Allways this result\";\n",
|
||||||
|
"console.log(\"current value (with getter) =\", obs.getContent());"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"To remove such a getter just set the getter property to `null`. \n",
|
||||||
|
"\n",
|
||||||
|
"The Original value is not changed ==> we expect to get \"1337\""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"// Reset the getter.\n",
|
||||||
|
"obs.getter = null;\n",
|
||||||
|
"console.log(\"current value (after removing the getter) =\", obs.getContent());"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "JavaScript (Node.js)",
|
||||||
|
"language": "javascript",
|
||||||
|
"name": "javascript"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"file_extension": ".js",
|
||||||
|
"mimetype": "application/javascript",
|
||||||
|
"name": "javascript",
|
||||||
|
"version": "17.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
84
wiki/12-Dispatcher.ipynb
Normal file
84
wiki/12-Dispatcher.ipynb
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"# NoPE - Dispatcher\n",
|
||||||
|
"\n",
|
||||||
|
"The NoPE-Dispatcher is designed as Layer between the different Modules / Dispatchers. They allow distributed computing or just a simple ***Service oriented Architecture*** (*SOA*). A dispatcher is used to link the modules, share data and events and provide a remote procedure call (rpc) interface.\n",
|
||||||
|
"\n",
|
||||||
|
"## Building Blocks of a Dispatcher:\n",
|
||||||
|
"\n",
|
||||||
|
"| element | description | \n",
|
||||||
|
"|-|-|\n",
|
||||||
|
"| `connectivityManager` | establishes a connection to other dispatchers and manages the status of the remotely connected dispatchers. It checks their health and removes dead dispatchers. |\n",
|
||||||
|
"| `eventDistributor` | shares events accross the network (or internally). You can use this element to listen for specific events. The subscription to those events allows `mqtt`-patterns. Additionaly, you are allowed to emit event on specific topics, or pattern based topics |\n",
|
||||||
|
"| `dataDistributor` | shares data accross the network (or internally). In comperisson to events, data is persistent and is available all the time. You can use this sub-module to listen for specific data-changes (install data-hooks), pull specific data or push data. You can pull / push data using a `mqtt`-pattern based path. |\n",
|
||||||
|
"| `rpcManager` | Used to perform `remote procedure calls` (see [here](https://de.wikipedia.org/wiki/Remote_Procedure_Call)). The manager keeps track of the available services. You must use the sub-module to register/unregister (new) services. |\n",
|
||||||
|
"| `instanceManager` | Used to create/dispose (remote) instances. The manager keeps track of the available instances in the network, allows to create `wrappers` for those instances. You must use the sub-module to register/unregister (new) instances. To allow the system to provide a service for creating instances of as specific type, you can provide a generator and provide it as `service`. |\n",
|
||||||
|
"\n",
|
||||||
|
"## Create a Dispatcher\n",
|
||||||
|
"\n",
|
||||||
|
"To start exploring the capabilities of the dispatcher we will firstly create a dispatcher with the code below:"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"// First lets install nope using npm\n",
|
||||||
|
"const nope = require(\"../dist-nodejs/index.nodejs\")\n",
|
||||||
|
"\n",
|
||||||
|
"// Lets create our dispatcher\n",
|
||||||
|
"const dispatcher = nope.dispatcher.getDispatcher({\n",
|
||||||
|
" // We will use the event layer (which just runs internally)\n",
|
||||||
|
" communicator: nope.getLayer(\"event\"),\n",
|
||||||
|
"\n",
|
||||||
|
" // We will adapt the timings (normally, we send a hartbeat and check for dead dispatchers)\n",
|
||||||
|
" timings: {\n",
|
||||||
|
"\n",
|
||||||
|
" /**\n",
|
||||||
|
" * Interval for the alive message given in [ms]. If \"0\" is provided,\n",
|
||||||
|
" * no alive messages are provided\n",
|
||||||
|
" *\n",
|
||||||
|
" * @author M.Karkowski\n",
|
||||||
|
" * @type {number}\n",
|
||||||
|
" */\n",
|
||||||
|
" sendAliveInterval: 0,\n",
|
||||||
|
"\n",
|
||||||
|
" /**\n",
|
||||||
|
" * Interval, to check the other dispatcher for being slow, dead, etc..\n",
|
||||||
|
" * should be lager then the \"sendAliveInterval\". The value is given in [ms]\n",
|
||||||
|
" * If \"0\" is provided, no alive messages are provided\n",
|
||||||
|
" *\n",
|
||||||
|
" * @author M.Karkowski\n",
|
||||||
|
" * @type {number}\n",
|
||||||
|
" */\n",
|
||||||
|
" checkInterval: 0\n",
|
||||||
|
" \n",
|
||||||
|
" }\n",
|
||||||
|
"});\n",
|
||||||
|
"console.log(dispatcher)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "JavaScript (Node.js)",
|
||||||
|
"language": "javascript",
|
||||||
|
"name": "javascript"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"file_extension": ".js",
|
||||||
|
"mimetype": "application/javascript",
|
||||||
|
"name": "javascript",
|
||||||
|
"version": "17.3.1"
|
||||||
|
},
|
||||||
|
"orig_nbformat": 4
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
32
wiki/install-jupyter.bat
Normal file
32
wiki/install-jupyter.bat
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
set DIR=%~dp0
|
||||||
|
cd "%DIR%"
|
||||||
|
|
||||||
|
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
|
||||||
|
|
||||||
|
@REM Link NPM-Folders
|
||||||
|
mkdir %PROGRAMDATA%\npm
|
||||||
|
setx PATH "%PROGRAMDATA%\npm;%PATH%" /M
|
||||||
|
npm config set prefix %PROGRAMDATA%\npm
|
||||||
|
|
||||||
|
%@Try%
|
||||||
|
@REM Uninstall IO-Server
|
||||||
|
pip3 install jupyter
|
||||||
|
npm install -g ijavascript && (
|
||||||
|
npm --registry https://npm.zema.de/ install -g nope && (
|
||||||
|
%appdata%\npm\ijsinstall
|
||||||
|
) || (
|
||||||
|
%appdata%\npm\ijsinstall
|
||||||
|
)
|
||||||
|
) || (
|
||||||
|
npm --registry https://npm.zema.de/ install -g nope && (
|
||||||
|
%appdata%\npm\ijsinstall
|
||||||
|
) || (
|
||||||
|
%appdata%\npm\ijsinstall
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
%@EndTry%
|
||||||
|
:@Catch
|
||||||
|
echo uninstall IO-Server
|
||||||
|
:@EndCatch
|
||||||
|
|
BIN
wiki/media/logo.png
Normal file
BIN
wiki/media/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
7
wiki/start-jupyter.bat
Normal file
7
wiki/start-jupyter.bat
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
set DIR=%~dp0
|
||||||
|
cd "%DIR%"
|
||||||
|
|
||||||
|
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
|
||||||
|
ijsnotebook --notebook-dir=./
|
||||||
|
import * as nope from "nope";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user