-
Notifications
You must be signed in to change notification settings - Fork 138
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
Add WebAssembly version with JavaScript bindings #303
Conversation
embind bindings
This is very cool! Thanks for doing it! I will take a look asap, but I am leaning towards having a separate repo just to keep the responsibilities split a bit, basically similar to how we have https://github.com/bodono/scs-python. Is that feasible to do? |
Yes, upon further reflection I agree it is cleaner to separate it. I'll make a separate repo and open a new pull request with only docs integration (not right now, but soon). |
To code up a little web app, I needed a convex solver with support for exponential cones, and SCS was the solver I found that was easiest to compile to WebAssembly. I added a target
make wasm
that produces filesscs.wasm
andscs.js
, wherescs.js
can then be loaded either in the browser or inside a Node.js environment and can be used to solve programs. I also added some convenient bindings. It works pretty well in my experience!I could keep the binding code in a separate repo focussed on providing the wasm version, but I thought it's a pretty minimal addition, so it could also be part of the main repository if you think it is a good idea.
A compiled version of the docs including my local additions is here:
https://dominik-peters.de/github/scs/
with new pages:
The example page contains a neat "live demo":