@basementuniverse/jsonpad-realtime-sdk 1.2.0 → 1.2.1
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 +23 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ const jsonpadRealtime = new JSONPadRealtime('your-api-token');
|
|
|
31
31
|
Browser:
|
|
32
32
|
|
|
33
33
|
```html
|
|
34
|
-
<script src="https://cdn.jsdelivr.net/npm/@basementuniverse/jsonpad-realtime-sdk@1.
|
|
34
|
+
<script src="https://cdn.jsdelivr.net/npm/@basementuniverse/jsonpad-realtime-sdk@1.2.1/build/jsonpad-realtime-sdk.js"></script>
|
|
35
35
|
<script>
|
|
36
36
|
|
|
37
37
|
const jsonpadRealtime = new JSONPadRealtime.default('your-api-token');
|
|
@@ -81,32 +81,46 @@ The `listen()` method takes an array of event types to listen for. You can pass
|
|
|
81
81
|
- `item-restored`
|
|
82
82
|
- `item-deleted`
|
|
83
83
|
|
|
84
|
-
You can also optionally pass in an array of list ids and item ids to listen for.
|
|
85
|
-
|
|
86
|
-
You can include `*` in the list ids and item ids arrays to listen for all lists or items.
|
|
84
|
+
You can also optionally pass in an array of list ids or path names, and item ids or aliases to listen for. For example:
|
|
87
85
|
|
|
88
86
|
```js
|
|
89
87
|
jsonpadRealtime.listen(
|
|
90
88
|
[
|
|
91
|
-
'list-created',
|
|
92
89
|
'list-updated',
|
|
93
|
-
'list-deleted',
|
|
94
|
-
'item-created',
|
|
95
90
|
'item-updated',
|
|
96
|
-
'item-restored',
|
|
97
|
-
'item-deleted',
|
|
98
91
|
],
|
|
99
92
|
[
|
|
100
93
|
'86059de7-9b16-4469-a630-23c8f69944b6',
|
|
101
94
|
'a2c706a6-5212-4e8a-92ad-bce1beea153f',
|
|
95
|
+
'my-list',
|
|
102
96
|
],
|
|
103
97
|
[
|
|
104
98
|
'e0bc4797-303a-49ff-b7b4-18781cc2460e',
|
|
105
99
|
'06ad5a22-c002-4c67-92bc-83ec85014461',
|
|
100
|
+
'my-item',
|
|
106
101
|
]
|
|
107
102
|
);
|
|
108
103
|
```
|
|
109
104
|
|
|
105
|
+
This will listen for `list-updated` events on the lists with ids `86059de7-9b16-4469-a630-23c8f69944b6` and `a2c706a6-5212-4e8a-92ad-bce1beea153f`, and the list with the path name `my-list` (provided those lists belong to the user who owns the token being used to authenticate).
|
|
106
|
+
|
|
107
|
+
It will also listen for `item-updated` events on the items with ids `e0bc4797-303a-49ff-b7b4-18781cc2460e` and `06ad5a22-c002-4c67-92bc-83ec85014461`, and the item with the alias `my-item` (again, provided those items belong to the user who owns the token being used to authenticate).
|
|
108
|
+
|
|
109
|
+
You can include `*` in the list ids and item ids arrays to listen for all lists or items. For example:
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
jsonpadRealtime.listen(
|
|
113
|
+
[
|
|
114
|
+
'list-updated',
|
|
115
|
+
'item-updated',
|
|
116
|
+
],
|
|
117
|
+
['*'],
|
|
118
|
+
['*']
|
|
119
|
+
);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
This will listen for any list being updated, and any item being updated.
|
|
123
|
+
|
|
110
124
|
## Event types
|
|
111
125
|
|
|
112
126
|
- `list-created`: A list was created.
|
package/package.json
CHANGED