processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.72k stars 3.34k forks source link

Improvement for 'loading...' div element when preload is used #3625

Open Ajayneethikannan opened 5 years ago

Ajayneethikannan commented 5 years ago

Nature of issue?

appropriate sub-area of p5.js?

Which platform were you using when you encountered this?

Details about the bug:

Feature enhancement details:

Currently , if any load method fails in preload function, the sketch does not proceed to setup and draw due to preload's blocking nature, but the text when preload is executing remains saying 'loading...' It would be nice to improve the feature , by making the text box say 'some error has occurred' when any method fails in the preload function.

Would love to hear suggestions on this, Thanks!

limzykenneth commented 5 years ago

Would be great if possible. I think the current challenge is to identify that a loading function call has failed and retaining capability for the user to handle the error themselves.

meiamsome commented 5 years ago

I am pro this in general, and agree with @limzykenneth that implementation is a bit problematic at the moment.

If/when we move to all-promise based preloads (#2698) this becomes much more plausible to implement, and would, indeed, be quite simple.

I could see a simple API being something like the following, with a default implementation of preloadFailed for when it is not manually specified:

function preload() {
  loadStrings('404.txt');
}

function preloadFailed() {
  // Allow the user to draw here maybe?
}

function draw() {
  // use the data from the loadStrings call
}
Ajayneethikannan commented 5 years ago

@meiamsome I kind of had a feeling it's implementation would become easier with promises, Thank you for the clarifications @limzykenneth , @meiamsome ! Would like to wait on it then :+1:

singhvisha commented 4 years ago

@limzykenneth ,can i work on this issue?

devashish1099 commented 4 years ago

@limzykenneth can u guide me where to look for solving this issue

limzykenneth commented 4 years ago

@singhvisha Are you still looking into this issue?

Hi @devashish1099, @singhvisha did asked to work on this first so I'll leave a few days for him to reply if he's still working on this issue. However, from the discussions above, there isn't a straightforward solution to this issue. If you want to have a crack at it anyway you can familiarize yourself with how preload and the loading functions work first, then if you come up with a solution, you can propose it here for us to discuss it.