So this is a weird idea (and probably stupid), but I recently stumbled upon webview while working on some unrelated frontend stuff. Now the big question is, what if we called into that from Lua? (or C, for that matter) It sounds so absurd that it might just work...
Goals:
Roadmap:
What are the drawbacks? Well, there's a few...
- The library is tiny and it's unclear how well it is maintained... it looks to be actively developed now, but that wasn't always the case
- The current threading model doesn't makes it easy to control the main loop from outside, though it seems that could be changed
- The docs are really bad, which doesn't inspire confidence. Then again, the library is a tiny wrapper and proper docs could be added
- On Windows, the WebView2 runtime cannot currently be linked statically due to Microsoft holding the entry point hostage (proprietary Loader DLL) - this might eventually change since there's a PR that seems to replace it with an open source wrapper
- Even if you did link it statically, the browser runtime is gigantic (like, 250 MB) so that would be even worse than Electron
- On the other hand, since it's provided by the operating system and NOT embedded this should generally be pretty lightweight
- However, it MUST be present on the system. That is not the default for Windows 10, so you need to ship it to end users
- Not all of the features that the native browser implements are exposed, in fact most aren't - Not sure what exactly is missing
- You would be running a JavaScript engine (V8) AND a Lua engine (LuaJIT), which is pretty wacky on a conceptual level
So this is a weird idea (and probably stupid), but I recently stumbled upon webview while working on some unrelated frontend stuff. Now the big question is, what if we called into that from Lua? (or C, for that matter) It sounds so absurd that it might just work...
Goals:
Roadmap:
run_onceAPI to allow integratingwebviewwith libuv's event loop from CwebviewAPIsSharedArayBuffer(need to check platform support)Transferablebuffers withwindow.postMessage(need to check how to get at the buffer from C/Lua)webview_bind(need to check if it can exchange data)webview(and the native SDK dynamically)What are the drawbacks? Well, there's a few...