Open habbes opened 6 years ago
I've done some research on web workers and realised this task will be more demanding than I thought because of the restrictions on what you can pass around between the host and web worker.
I started experimenting with some possible implementations that may work for Xaval. Here's one demo of creating a "bridge" between the host page and web worker. I might explore other ideas and approaches.
This feature might also require me to rethink the architecture and foundation of Xaval and some of its APIs and end up requiring considerable changes and maybe rewrites. I can already foresee that all I/O APIs will have to be asynchronous (e.g. imageSource.read()
) and I'm not sure yet how this would work with widget models (whether they'll live in the host or worker).
For this reason, I think it's best I work on this after I've worked on some of the other useful but less-demanding features (e.g. multi-file library, video support, widgets improvements, etc.) because working on this might block development of other features for a couple of weeks.
At the moment the source code in the editor is evaluated and executed on the main thread, if the code has a long running loop, it would freeze the UI. Consider running the code in a background worker.