Class for connecting dynamic learning with p5 web editor sketch
Add this js file for connecting a sketch to dynamic learning to save the state of a simulation.
let dl;
function setup() {
dl = new DL();
dl.load(initialize)
// More code
}
const initialize = (data) => {
if(!data) {
// Initialize the sketch by default values
} else {
// Initialize the sketch by using data object
}
}
const onSomeEvent = () => {
dl.save(dataToSaveForTheSketch)
// More code
}