-
Notifications
You must be signed in to change notification settings - Fork 37
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
Solid JS APi to use pyp5js #189
Milestone
Comments
This was referenced Oct 30, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This issue probably depends on having #188 done since it should significantly reduce the amount of duplicated JS code.
Currently, to simply use pyp5js to run a sketch via JS can be hard. Take the demo editor for example.
pyp5js
forced it to be a regular sketch with ademo.py
file when this should be unnecessary. There should be a more elegant way to use pyp5js as a JS-like library.Of course, such type of usage would only work under Pyodide mode since Transcrypt requires a transpilation step. In my best dream, we'd have a
pyp5js.js
file being served over a CDN (or maybe installable via npm?) and with an API you would use like:A question I have is: how to expose the p5 sketch object? Currently we're poorly storing it on
window.instance
, but the naming sucks, although I'm no expert on Javascript to have proper opinion if adding new variables to thewindow
object is a bad thing or not. Insights here would be helpful =)There's a lot to be done to achieve this. From the top of my head, I can list:
window.runSketchCode
to be a promise instead of synchronous function;PyP5Js
object exposing therunCode
function;runCode
should download Pyodide and properly configure it;.tar.gz
file?)The text was updated successfully, but these errors were encountered: