I am experiencing an issue with a webpage that is running 2 processing sketches. I came across a suggestion to call Processing.instances[0].exit() in response to a question on dynamically unloading a Processing JS sketch from canvas.
However, when I attempt to call Processing.instances, it returns null and there are no errors displayed on the JavaScript console - additionally, Processing.instances.length also returns (0).
Below is the snippet of JavaScript code:
document.onkeydown = function(e) { // or document.onkeypress
e = e || window.event;
if (e.keyCode == 115 || e.keyCode == 83) { //press "s" or "S"
alert(Processing.instances.length);
}
};
For reference, here is the URL of the website:
Thank you