@graffy/client 0.15.17 → 0.15.19-alpha.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 +24 -4
- package/package.json +4 -4
package/Readme.md
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
# Graffy Client
|
|
2
2
|
|
|
3
|
-
Graffy client library for the browser.
|
|
3
|
+
Graffy client library for the browser, usin the `fetch()` or `WebSocket` APIs. This module is intended to be used with a Node.js server running Graffy Server.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```js
|
|
8
|
+
import Graffy from '@graffy/core';
|
|
9
|
+
import client from '@graffy/client';
|
|
10
|
+
|
|
11
|
+
const store = new Graffy();
|
|
12
|
+
store.use(client(url, options));
|
|
13
|
+
|
|
14
|
+
// Add downstream providers to the store
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
An HTTP connection is used if the URL begins with `http(s)://`, and a Websocket is used if it begins with `ws(s)://`.
|
|
18
|
+
|
|
19
|
+
### Options
|
|
20
|
+
|
|
21
|
+
- `getOptions(operation, payload, options)`, a callback to get the options that should be passed to the server with each operation.
|
|
22
|
+
- `connInfoPath`, a location in the store to put connection metadata. Defaults to `connection`.
|
|
23
|
+
|
|
24
|
+
### Connection status
|
|
25
|
+
|
|
26
|
+
If using a WebSocket connection, Graffy client creates a `connection: { status: boolean }` node in the store. The location of this node can be controlled by the `connInfoPath` option. Reading from or watching this node provides information about the current connection status. The application may explicitly tear-down or re-establish connections by writing `false` or `true` to it, respectively.
|
|
27
|
+
|
|
28
|
+
See [Graffy documentation](https://graffy.org#/GraffyClient) for more.
|
|
8
29
|
|
|
9
|
-
See [Graffy documentation](https://aravindet.github.io/graffy/#/GraffyClient) for more.
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graffy/client",
|
|
3
|
-
"description": "Graffy client library for the browser.",
|
|
3
|
+
"description": "Graffy client library for the browser, usin the `fetch()` or `WebSocket` APIs. This module is intended to be used with a Node.js server running Graffy Server.",
|
|
4
4
|
"author": "aravind (https://github.com/aravindet)",
|
|
5
|
-
"version": "0.15.
|
|
5
|
+
"version": "0.15.19-alpha.2",
|
|
6
6
|
"main": "./index.cjs",
|
|
7
7
|
"exports": {
|
|
8
8
|
"import": "./index.mjs",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@graffy/
|
|
20
|
-
"@graffy/
|
|
19
|
+
"@graffy/stream": "0.15.19-alpha.2",
|
|
20
|
+
"@graffy/common": "0.15.19-alpha.2",
|
|
21
21
|
"debug": "^4.3.3"
|
|
22
22
|
}
|
|
23
23
|
}
|