p5.js icon indicating copy to clipboard operation
p5.js copied to clipboard

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

Open Ajayneethikannan opened this issue 6 years ago • 6 comments

Nature of issue?

  • [x] Existing feature enhancement

appropriate sub-area of p5.js?

  • [x] Core/Environment/Rendering

Which platform were you using when you encountered this?

  • [x] Mobile/Tablet (touch devices)
  • [x] Desktop/Laptop
  • [x] Others (specify if possible) - Device independent

Details about the bug:

  • p5.js version: 0.7.3
  • Web browser and version: Browser independent
  • Operating System: OS independent
  • Steps to reproduce this:

https://editor.p5js.org/TheSkepticSniper/sketches/Hpintvgpy - This sketch can be used for reference

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!

Ajayneethikannan avatar Mar 20 '19 09:03 Ajayneethikannan

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.

limzykenneth avatar Mar 23 '19 16:03 limzykenneth

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
}

meiamsome avatar Mar 23 '19 16:03 meiamsome

@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:

Ajayneethikannan avatar Mar 23 '19 16:03 Ajayneethikannan

@limzykenneth ,can i work on this issue?

singhvisha avatar Jan 09 '20 19:01 singhvisha

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

devashish1099 avatar Feb 22 '20 08:02 devashish1099

@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.

limzykenneth avatar Feb 22 '20 13:02 limzykenneth

Closing as duplicate https://github.com/processing/p5.js/issues/6795

ksen0 avatar Apr 17 '25 11:04 ksen0