Where is the
whileLoadingCallback for images? I know p5 has one for sound, but not images for some reason…
Well, you know what, if you’re going to add on for images, what about adding them for tables or XML Files, etc.
p5.js-sound is a separate library which although is bundled w/ p5.js we still need to load it as an addon.
p5.js-sound relies on XMLHttpRequest to load sound files:
And it happens that it has a builtin triggered event for loading progress:
Main library p5.js used XMLHttpRequest in the past; but now it relies on the Fetch API instead via its method httpDo():
However the Fetch API doesn’t have a straight progress event like its XMLHttpRequest predecessor.
Nevertheless there are some hacks to emulate the loading progress feature:
You may attempt to request the p5js devs to include some fetch() progress hack into its loading functions:
But have in mind that even when p5.js used to rely on XMLHttpRequest back then they opted not to have any progress loading callback.