From 8b2b9e1093c55bc175a0fab621aa94b0eb9f3ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kl=C3=A4hn?= <39526136+Septias@users.noreply.github.com> Date: Tue, 19 Apr 2022 15:43:05 +0200 Subject: [PATCH] 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 * Update draft/webxdc-dev-reference.md Co-authored-by: Simon Laux Co-authored-by: holger krekel --- draft/webxdc-dev-reference.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/draft/webxdc-dev-reference.md b/draft/webxdc-dev-reference.md index ddfc7351c..591006e2e 100644 --- a/draft/webxdc-dev-reference.md +++ b/draft/webxdc-dev-reference.md @@ -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; ``` 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: