@hcikn/colibri 1.1.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -3
- package/dist/index.cjs +607 -152
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +121 -35
- package/dist/index.d.ts +121 -35
- package/dist/index.js +574 -128
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -11,10 +11,10 @@ Initialize Colibri once with:
|
|
|
11
11
|
|
|
12
12
|
```ts
|
|
13
13
|
import { Colibri } from '@hcikn/colibri';
|
|
14
|
-
Colibri
|
|
14
|
+
new Colibri('app_name', 'server_address');
|
|
15
15
|
|
|
16
16
|
// if using a custom port:
|
|
17
|
-
Colibri
|
|
17
|
+
new Colibri('app_name', 'server_address', 9011);
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
For server setup, refer to [colibri-server](../colibri-server/).
|
|
@@ -29,7 +29,11 @@ To setup, import the `RemoteLogger` and call its `init()` method. Any subsequent
|
|
|
29
29
|
|
|
30
30
|
```ts
|
|
31
31
|
import { RemoteLogger } from '@hcikn/colibri';
|
|
32
|
-
RemoteLogger
|
|
32
|
+
const logger = new RemoteLogger();
|
|
33
|
+
|
|
34
|
+
// en-/disable RemoteLogger
|
|
35
|
+
logger.enable();
|
|
36
|
+
logger.disable();
|
|
33
37
|
```
|
|
34
38
|
|
|
35
39
|
See also [the remote-logging sample](samples/remote-logging.ts) (run sample with `npm run sample/remote-logging`).
|
|
@@ -125,6 +129,28 @@ registerExampleClass(mySample); // mySample is sent out to all other clients and
|
|
|
125
129
|
|
|
126
130
|
See also [the model-sync sample](samples/model-sync.ts) (run sample with `npm run sample/model-sync`).
|
|
127
131
|
|
|
132
|
+
### Remote Store
|
|
133
|
+
|
|
134
|
+
Colibri offers persistent data storage on the server, so that data can be shared easily between connected clients. Each object is identified by it's individual `key`:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
import { Colibri, GetRestApi, PutRestApi } from '@hcikn/colibri';
|
|
138
|
+
|
|
139
|
+
const colibri = Colibri.getInstance();
|
|
140
|
+
const key = 'sampleKey';
|
|
141
|
+
const data = {...};
|
|
142
|
+
|
|
143
|
+
// fetch data
|
|
144
|
+
colibri.getRestObject(key); // or...
|
|
145
|
+
GetRestApi(key);
|
|
146
|
+
|
|
147
|
+
// update data
|
|
148
|
+
colibri.setRestObject(key, data); // or...
|
|
149
|
+
PutRestApi(key, data);
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Each operation can be achieved by either directly interaction with the `Colibri` object or using the corresponding wrapper method.
|
|
153
|
+
|
|
128
154
|
## Samples
|
|
129
155
|
|
|
130
156
|
See [Sample folder](samples/) for more examples on how to use the Colibri web client.
|