My p5js app runs the setup
function twice. I have stripped the whole thing down as much as possible, and it’s still happening. This is messing with my app because (a) I wish to run some fairly heavy operations in setup and (b) I add some objects to an array in setup, and if it runs twice then the objects are doubled up.
My index.js
looks like this:
const sketch = (processing) => {
processing.setup = () => {
console.log('run setup');
};
};
const myProcessing = new p5(sketch);
…and my index.html
looks like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>vis-p5js</title>
</head>
<body>
<div id="test"></div>
</body>
<script src="./lib/p5.js"></script>
<script src="./lib/p5.sound.js"></script>
<script type="module" src="./src/index.js"></script>
</html>