This PR adds a new sketch lifecycle function named dispose() that allows a sketch to run some code before getting reloaded, such as cleaning up effects, removing elements, destroying textures... and so on.
Example
let element;
export let init = ({ canvas }) => {
element = document.createElement('div');
canvas.parentNode.appendChild(element);
}
export let dispose = () => {
element.parentNode.removeChild(element);
}
This PR adds a new sketch lifecycle function named
dispose()
that allows a sketch to run some code before getting reloaded, such as cleaning up effects, removing elements, destroying textures... and so on.Example