You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+89-2Lines changed: 89 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,7 +170,7 @@ for await (const event of client.readEvents('/books/42', {
170
170
171
171
If you need to abort reading use `break` or `return` within the `await for` loop. However, this only works if there is currently an iteration going on.
172
172
173
-
To abort reading independently of that, hand over an abort signal as third parameter when calling `readEvents`, and abort the appropriate `AbortController`:
173
+
To abort reading independently of that, hand over an abort signal as third argument when calling `readEvents`, and abort the appropriate `AbortController`:
174
174
175
175
```typescript
176
176
const controller =newAbortController();
@@ -254,7 +254,7 @@ for await (const event of client.observeEvents('/books/42', {
254
254
255
255
If you need to abort observing use `break` or `return` within the `await for` loop. However, this only works if there is currently an iteration going on.
256
256
257
-
To abort observing independently of that, hand over an abort signal as third parameter when calling `observeEvents`, and abort the appropriate `AbortController`:
257
+
To abort observing independently of that, hand over an abort signal as third argument when calling `observeEvents`, and abort the appropriate `AbortController`:
258
258
259
259
```typescript
260
260
const controller =newAbortController();
@@ -269,3 +269,90 @@ for await (const event of client.observeEvents('/books/42', {
269
269
// observing to end.
270
270
controller.abort();
271
271
```
272
+
273
+
### Registering an Event Schema
274
+
275
+
To register an event schema, call the `registerEventSchema` function and hand over an event type and the desired schema:
To list all subjects, call the `readSubjects` function with `/` as the base subject. The function returns an asynchronous iterator, which you can use e.g. inside a `for await` loop:
If you need to abort listing use `break` or `return` within the `await for` loop. However, this only works if there is currently an iteration going on.
315
+
316
+
To abort listing independently of that, hand over an abort signal as second argument when calling `readSubjects`, and abort the appropriate `AbortController`:
317
+
318
+
```typescript
319
+
const controller =newAbortController();
320
+
321
+
forawait (const subject ofclient.readSubjects(
322
+
'/', controller.signal)
323
+
) {
324
+
// ...
325
+
}
326
+
327
+
// Somewhere else, abort the controller, which will cause
328
+
// reading to end.
329
+
controller.abort();
330
+
```
331
+
332
+
### Listing Event Types
333
+
334
+
To list all event types, call the `readEventTypes` function. The function returns an asynchronous iterator, which you can use e.g. inside a `for await` loop:
If you need to abort listing use `break` or `return` within the `await for` loop. However, this only works if there is currently an iteration going on.
345
+
346
+
To abort listing independently of that, hand over an abort signal as argument when calling `readEventTypes`, and abort the appropriate `AbortController`:
0 commit comments