Skip to content
Snippets Groups Projects
Commit afdd3fe7 authored by Cheng Shao's avatar Cheng Shao :beach: Committed by Marge Bot
Browse files

docs: document the wasm backend promise.throwTo() feature

parent 7f80455e
No related branches found
No related tags found
No related merge requests found
......@@ -715,3 +715,14 @@ JavaScript.
Finally, in JavaScript, you can use ``await __exports.my_func()`` to
call your exported ``my_func`` function and get its result, pass
arguments, do error handling, etc etc.
For each async export, the returned ``Promise`` value contains a
``promise.throwTo()`` callback. The value passed to
``promise.throwTo()`` will be wrapped as a ``JSException`` and raised
as an async exception in that thread. This can be useful for
interrupting Haskell computation in JavaScript. ``promise.throwTo()``
doesn't block the JavaScript caller like Haskell ``throwTo``. It
doesn't necessarily result in ``promise`` being rejected since the
Haskell thread can handle the async exception, and it can be called
multiple time. It has no effect when the respective Haskell thread has
already run to completion.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment