Wasm DOM 访问和引用类型
Wasm DOM access and Reference types
我一直在密切关注 webassembly 的路线图,特别是调用 JS 互操作的性能影响。作为此 reference types proposal we are going to be able to have basic manipulation of tables inside Wasm. Phase 4 has been approved June 23rd meeting. Firefox and Chrome are working on the implementation of this proposal WebAssembly roadmap. Chromium implementation. Based on this answer Wasm access dom 的一部分。并引用铬描述
Allow WebAssembly modules to hold references to JS/DOM objects, passing them as arguments, storing them in locals and globals, and storing them in WebAssembly.Table objects.
这会允许从 wasm 访问 DOM 吗?还是需要进一步的实施?请问improve/match JS性能访问DOM?这是否允许在 wasm 中有一个虚拟的 DOM 而只在真实的 DOM 中进行必要的更改? @Andreas Rossberg?
添加 Andreas Rossberg 的回复 Explain the conection of GC and DOM-Access
However, the new proposal for reference types that we split off from the GC proposal tries to give a more nuanced answer to that. It introduces reference types without any functionality for allocating anything within Wasm itself. In an embedding where host references are garbage-collected that still requires a Wasm implementation to understand GC. But in other embeddings it does not need to.
为了完整性而编辑 webassembly-interface-types
模块可以在 Wasm 中存储对 DOM 对象(或相应主机环境提供的任何内容)的引用,但要访问它们,它需要导入相应的功能。那不会改变。 Wasm 是一个虚拟指令集,而不是 API。而且它不是特定于 Web 的。
但是,当然,您现在可以在 Wasm 中实现一个丰富的库,例如影子 DOM 或虚拟 DOM,它完成了 Wasm 中的大部分工作,并且只调用真实 DOM 需要的地方。
我一直在密切关注 webassembly 的路线图,特别是调用 JS 互操作的性能影响。作为此 reference types proposal we are going to be able to have basic manipulation of tables inside Wasm. Phase 4 has been approved June 23rd meeting. Firefox and Chrome are working on the implementation of this proposal WebAssembly roadmap. Chromium implementation. Based on this answer Wasm access dom 的一部分。并引用铬描述
Allow WebAssembly modules to hold references to JS/DOM objects, passing them as arguments, storing them in locals and globals, and storing them in WebAssembly.Table objects.
这会允许从 wasm 访问 DOM 吗?还是需要进一步的实施?请问improve/match JS性能访问DOM?这是否允许在 wasm 中有一个虚拟的 DOM 而只在真实的 DOM 中进行必要的更改? @Andreas Rossberg?
添加 Andreas Rossberg 的回复 Explain the conection of GC and DOM-Access
However, the new proposal for reference types that we split off from the GC proposal tries to give a more nuanced answer to that. It introduces reference types without any functionality for allocating anything within Wasm itself. In an embedding where host references are garbage-collected that still requires a Wasm implementation to understand GC. But in other embeddings it does not need to.
为了完整性而编辑 webassembly-interface-types
模块可以在 Wasm 中存储对 DOM 对象(或相应主机环境提供的任何内容)的引用,但要访问它们,它需要导入相应的功能。那不会改变。 Wasm 是一个虚拟指令集,而不是 API。而且它不是特定于 Web 的。
但是,当然,您现在可以在 Wasm 中实现一个丰富的库,例如影子 DOM 或虚拟 DOM,它完成了 Wasm 中的大部分工作,并且只调用真实 DOM 需要的地方。