Open trusktr opened 5 years ago
There is no require in the browser context and there is no good way to emulate require in the user land JS. I also would like to keep the web side as close to the real web as possible.
carloFunction
is only useful for small and demo apps. It only returns serialized types.
RPC is what should be used for real world applications. Check out how app.load
gets and returns rpc handles that can be used across the world. That's how front-end gets instances of the backend objects and vice versa. Check out the bundled examples (and tests), they are all using the rpc.
Can https://requirejs.org/ be used for that somehow?
Is it possible to use
require
like in Electron to import NPM modules in the browsing context?If such feature doesn't exist, is it possible to write code for the feature in JS? Or would it require C++ in the lower levels?
Are
carloFunction
s defined withWindow.exposeFunction
able to return references? Or only serializable data? I can see how to implementrequire
if it returns references.