js-runtime: add/upstream new js-runtime library inspired by Go's syscall/js package #390

Merged
iddev5 merged 3 commits from ay-js-runtime into main 2022-07-07 11:35:20 +00:00
iddev5 commented 2022-07-06 12:55:41 +00:00 (Migrated from github.com)

Upstreams js-runtime from https://github.com/iddev5/zig-js-runtime. This module should be considered experimental and its API is not final. It is inspired from Go's syscall/js module. It is not a reimplementation, but rather an independent implementation.

There is also a workaround for a limitation right now. The html-generator has no way to dynamically add JS sources (and that can't be done without using a preprocessor library) so we hardcode js-runtime in it.

In the future, I think the correct behavior would be to move tools/ inside js-runtime along with a wasm application building SDK and get rid of any direct JS access we have today (which is just src/platform/wasm.zig and src/platform/mach.js).


  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.
Upstreams js-runtime from https://github.com/iddev5/zig-js-runtime. This module should be considered experimental and its API is not final. It is inspired from Go's syscall/js module. It is not a reimplementation, but rather an independent implementation. There is also a workaround for a limitation right now. The html-generator has no way to dynamically add JS sources (and that can't be done without using a preprocessor library) so we hardcode js-runtime in it. In the future, I think the correct behavior would be to move tools/ inside js-runtime along with a wasm application building SDK and get rid of any direct JS access we have today (which is just src/platform/wasm.zig and src/platform/mach.js). --- - [X] By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.
emidoots (Migrated from github.com) approved these changes 2022-07-07 11:33:56 +00:00
emidoots (Migrated from github.com) left a comment

🔥 I'm so excited to start playing with this more

In the future, I think the correct behavior would be to move tools/ inside js-runtime along with a wasm application building SDK and get rid of any direct JS access we have today (which is just src/platform/wasm.zig and src/platform/mach.js).

agree

🔥 I'm so excited to start playing with this more > In the future, I think the correct behavior would be to move tools/ inside js-runtime along with a wasm application building SDK and get rid of any direct JS access we have today (which is just src/platform/wasm.zig and src/platform/mach.js). agree
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach!390
No description provided.