From e82fcb5164268bca88ff02d87e075349ba7327e3 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 31 Oct 2022 02:25:16 +0300 Subject: [PATCH] updated docs... Signed-off-by: Alex A. Naanou --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 8f79699..7b1a574 100644 --- a/README.md +++ b/README.md @@ -2903,6 +2903,21 @@ from being called. -> undefined ``` +Note that for `async` event `(..)` it might be useful to trigger +the handlers after the promise resolves, this can be done by first calling +`(false)` to prevent the handlers from being triggered as soon +as the promise is returned and after an appropriate `await`ing calling +`()` to actually trigger the handlers. + +Example: +```javascript +var evt = event.Event('evt', async function(handler, ...args){ + handler(false) + var value = await something() + handler() + return value }) +``` + **Special case: ``**