Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plan for low resource devices #40

Open
lastmjs opened this issue Mar 15, 2017 · 2 comments
Open

Plan for low resource devices #40

lastmjs opened this issue Mar 15, 2017 · 2 comments

Comments

@lastmjs
Copy link
Member

lastmjs commented Mar 15, 2017

Looks like a tentative plan is still to use jsdom on low resource devices. Getting Node.js to run on those devices looks hard, but if we can compile jsdom to C, we should hopefully be able to run it straight on those devices. This project looks promising for compiling JS to C: https://github.com/andrei-markeev/ts2c/blob/master/README.md

The project is planning on having 95% of ES3 capabilities by the end of the year. We could go from jsdom, which is probably written in ES5, to ES3, and then to C. I'm not sure if jsdom uses any node APIs, we would have to somehow port those over. That looks like a good path. This means we still need to implement custom elements in jsdom. That seems like a solid solution to eventually getting web components to work on all devices.

Now, another possibility is to wait for a good web assembly interpreter that can run on low resource devices. Then we could compile jsdom to wasm, and run it right on the device like that. We'll have to watch the landscape to see how low resource wasm code can run.

So, the conclusion is, implementing custom elements in jsdom looks like the next best step to getting web components onto devices that cannot run Electron or Node.js. In order of resources needed: Electron -> Node.js -> wasm -> C. JSDOM should work for all devices in this spectrum.

@lastmjs
Copy link
Member Author

lastmjs commented Mar 15, 2017

Instead of compiling jsdom to C, what if we compiled the HTML and DOM implementations from Chromium to wasm? For more info: jsdom/jsdom#1772

@lastmjs
Copy link
Member Author

lastmjs commented Apr 25, 2017

Looks like we can move forward with jsdom. Take a look at the end of the comments here: jsdom/jsdom#1030 (comment)

We should be able to use this library to get jsdom to work. We'll have to hack around again so that Node is available to the code

https://github.com/WebReflection/document-register-element

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant