-
Notifications
You must be signed in to change notification settings - Fork 44
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
Allow the embedder to specify p5 addon libraries to load #53
Comments
Hmm, so this might actually be a bit trickier than I thought... In The challenge with adding p5 add-on libraries is that they need to be added after the main p5 script is loaded (or else their calls to e.g. Normally this is just done by adding another There might be a few ways to work around this:
I think I like options 1 and 3. Option 2 is right out. @kaganjd does any of this make sense? It's a lot more complicated than I thought it'd be, but I think we can still do it! (Sorry I said it'd be easy, though... 😣) |
@toolness I've been thinking about option 1. Just to make sure I'm on the right track, are you saying that instead of the [1] p5.js-widget/lib/preview-frame.ts Line 12 in 7670852
[2] https://gist.github.com/kaganjd/fef5209591233473c2cd7a8e796997be |
Yep! Or slightly more accurately, creates an iframe within
It's important to note that in an ideal scenario, we'd actually host Ummm I think that's one way forward, at least. Wanna make a protoype? 😁 |
Blergh now I am starting to wonder if there are other ways to do this without making yet another iframe. I think we actually re-create the preview frame every time the user changes their code, in which case we could potentially just deliver all the required information through querystring arguments... Arg, why is this so hard. Sorry about this, I really thought it'd be a lot easier! |
Maybe Javascript promises could be useful here? I'll start looking into |
I don't have a lot of p5 experience, but just in straight front-end programming terms, option 3 sounds like the least amount of work 👍 Changing the semantics of |
Good point @6a68 ! Thanks for the feedback. |
Hi @toolness, did you get anywhere on this? I'm working on a tutorial for p5.sound right now and would love to use your widget for this (it would be very helpful to have p5.dom as well). I suppose that based on your answer about the script loading order, something simple like adding the add-on library urls to the loadScripts part of the code won't work? |
Hi @toolness, Just LOVE your p5.js-widget! I wonder if anyone found an answer to how to add on p5.dom to it? |
Might be nice for tutorials that want to use p5.sound, p5.dom, et cetera.
The text was updated successfully, but these errors were encountered: