q5js / q5.js

A sequel to p5.js that's optimized for interactive art!
https://q5js.org
GNU Lesser General Public License v3.0
123 stars 9 forks source link

Failure function callback not called when loadImage fails to load image #55

Closed pvzzombs closed 4 months ago

pvzzombs commented 4 months ago

Replication link: jsfiddle

Javascript code:

function success() {
  alert("Success");
}

function fail() {
  alert("Fail");
}

function preload() {
  loadImage("doesnotexist.png", success, fail);
}

function setup() {
  createCanvas(200, 200);
}

function draw() {
  background(128);
}

Actual behavior:

pvzzombs commented 4 months ago

Here is the reference: https://p5js.org/reference/p5/loadImage/

quinton-ashley commented 4 months ago

q5's loadImage doesn't accept a failure callback, it will simply throw an error to the js console. In q5 the third param to loadImage is a canvas options object.

I will note this as a difference from p5's api in the readme.md.