update dev-reference to reflect new promise feature for setup (#3220)

* update dev-reference

* Update draft/webxdc-dev-reference.md

Co-authored-by: holger krekel  <holger@merlinux.eu>

* Update draft/webxdc-dev-reference.md

Co-authored-by: Simon Laux <Simon-Laux@users.noreply.github.com>
Co-authored-by: holger krekel  <holger@merlinux.eu>
This commit is contained in:
Sebastian Klähn
2022-04-19 15:43:05 +02:00
committed by GitHub
parent a8cf05ea5d
commit 8b2b9e1093

View File

@@ -54,12 +54,13 @@ and you won't get the update by `setUpdateListener()`.
### setUpdateListener()
```js
window.webxdc.setUpdateListener((update) => {}, serial);
window.webxdc.setUpdateListener((update) => {}, serial) -> Promise<void>;
```
With `setUpdateListener()` you define a callback that receives the updates
sent by `sendUpdate()`. The callback is called for updates sent by you or other peers.
The `serial` specifies the last serial that you know about (defaults to 0).
The returned promise resolves when the listener has processed all the update messages known at the time when `setUpdateListener` was called.
Each `update` which is passed to the callback comes with the following properties: