yrashk / bpxe.rs

Business Process eXecution Engine
Apache License 2.0
36 stars 10 forks source link

Problem: not sure if it is possible to run in the browser #17

Closed yrashk closed 3 years ago

yrashk commented 3 years ago

Solution: abstract task and select one right for the target

The abstraction is located in crate::sys::task

This maps spawn and spawn_blocking on WASM to wasm_bindgen_futures::spawn_local. The former is perhaps the right choice but it's not perfect for spawn_blocking that'll actually block.

This change introduces a new crate (bpxe-internal-macros) that adds its own #[bpxe_internal_macros] attribute that will pick the correct attributes and whatever other necessary setup to run a test on a target.

In order to make tests run I had to develop a simplistic single-threaded executor for WASM. It's using a lot of unsafe code, but it seems to work so far.

This change brings some crude JS API for BPXE that allows some experimentation. It can be demoed using examples/bpxe_wasm_demo

yrashk commented 3 years ago

I've removed WebAssembly builds for now as they aren't working well on GitHub Actions (one seemed to work, and one simply hans). I am thinking to use an external CI to run those. These wasm tests do pass on my computer, so I am inclined to merge this as is.