# Blocking operations in the WASM version (JavaScript expertise needed)

**URL:** <https://swi-prolog.discourse.group/t/blocking-operations-in-the-wasm-version-javascript-expertise-needed/5655>\
**Category:** Help!\
**Tags:** javascript, wasm, browser, async\
**Created:** [August 4, 2022, 4:07pm UTC](https://swi-prolog.discourse.group/t/blocking-operations-in-the-wasm-version-javascript-expertise-needed/5655 "2022-08-04T16:07:51Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [August 5, 2022, 3:47pm UTC](https://swi-prolog.discourse.group/t/blocking-operations-in-the-wasm-version-javascript-expertise-needed/5655/13 "2022-08-05T15:47:18Z")

</div>

The code is still ugly, but [SWI-Prolog WebAssembly build test](http://dev.swi-prolog.org/wasm) now uses yield to read goals and ask whether or not to try and produce more answers. If anyone is interested:

- The JavaScript binding is in [swipl-devel/src/wasm/prolog.js](https://github.com/SWI-Prolog/swipl-devel/blob/22b4d839654cf2965e3438af1bcb98848f275c2a/src/wasm/prolog.js)
- The shell is in [swipl-devel/src/wasm/shell.html](https://github.com/SWI-Prolog/swipl-devel/blob/22b4d839654cf2965e3438af1bcb98848f275c2a/src/wasm/shell.html)

Please shoot at the JavaScript. Notably I think the async stuff can be written way more elegantly.

The code is in the main swipl-devel.git, in the **branch** [yield\_wasm](https://github.com/SWI-Prolog/swipl-devel/tree/yield-wasm).

---

_[View the full topic](https://swi-prolog.discourse.group/t/blocking-operations-in-the-wasm-version-javascript-expertise-needed/5655)._
