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

async load function #45

Open
quinton-ashley opened this issue Jun 19, 2024 · 1 comment
Open

async load function #45

quinton-ashley opened this issue Jun 19, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@quinton-ashley
Copy link
Collaborator

An async function simply named load could be used to load any file or multiple files asynchronously and return a promise.

This will be implemented in q5-util.js The q5 setup function is already async.

This idea was suggested by @mattdesl and iterated on by @mvicky2592 in this p5.js issue discussion. I also think keeping the preload system for backwards compatibility and ease of use for beginners is the right idea though.
processing/p5.js#6767

@quinton-ashley quinton-ashley added the enhancement New feature or request label Jun 20, 2024
DipakKhade pushed a commit to DipakKhade/q5.js that referenced this issue Jul 24, 2024
@quinton-ashley
Copy link
Collaborator Author

quinton-ashley commented Jul 24, 2024

@DipakKhade Thanks for the PR! But please comment on an issue before trying to implement a feature though.

The implementation of load(...args) should use Promise.all. Also it should be able to load many types of files, not just text and json. It would need to be a function added to instances of Q5 not Q5 itself, in order to access other loading functions.

After examining the p5 feature request again more closely, I'm a bit confused myself about how they plan to support loading images, video, and sounds with this one method. I suppose it could wrap preload functions like loadImage and loadSound in a promise. What do you think of that idea?

I also think we need to figure out a way for addon developers to add support to q5 load for loading additional file types but that could be added after an initial implementation is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant