This is to track progress of compiling the Dark execution engine (interpreter plus most of the standard library) to WASM to run in editor/browser. (In the OCaml version, this was done by js_of_ocaml, in jsanalysis.ml).
It is currently working in some form in https://github.com/CedricRup/dark/tree/blazor-webworker, and "just" needs to be adapted to load as part of the client.
Overall end state:
- When the editor loads, it should load the F# execution engine in a web worker
- when receiving a message from the client, it deserializes it, executes it, and reserializes the response
- during deployment, the compiled engine gets uploaded to the CDN
- we can run it in the editor by adding a feature flag
- integration tests pass with the feature flag
Current ocaml implementation:
- appsupport.js creates the main thread and the worker constructs for communication
- window.Dark.analysis on the client side
- window.AnalysisWorker is on the Worker side
- window.analysisWorker is made up of AnalysisWorker.ml (via bucklescript and browserify) and jsanalysis.ml (via js_of_ocaml)
- window.Dark.analysis.requestAnalysis makes the request to the web worker from the client and receives the response. It's called from within the client
What we currently have in F#:
- src/Wasm/wwwroot/index.html - has the config for how to call BlazorWorker.js
- src/Wasm/wwwroot/BlazorWorker.js - loads in the main thread, creates a worker, sends a request to it. Loads all the dlls, etc
- inits the worker with window.BlazorWorker.initWorker()
- has controls to postMessage
Tasks:
This is to track progress of compiling the Dark execution engine (interpreter plus most of the standard library) to WASM to run in editor/browser. (In the OCaml version, this was done by js_of_ocaml, in jsanalysis.ml).
It is currently working in some form in https://github.com/CedricRup/dark/tree/blazor-webworker, and "just" needs to be adapted to load as part of the client.
Overall end state:
Current ocaml implementation:
What we currently have in F#:
Tasks: