Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions IDE/public/gui/js/GuiHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,26 +220,25 @@ export default class GuiHandler {
return scriptElement;
}

updateP5(p5) {
p5.prototype.loadScript = function (path) {

const ret = {};
var that = this;
let resource = Bela.control.loadResource(path)
.then(()=>{
if (typeof that._decrementPreload === 'function') {
that._decrementPreload();
}
})
.catch(()=>{
});

return resource;
};

p5.prototype.registerPreloadMethod('loadScript', p5.prototype);
p5 = new p5();
return p5;
}

updateP5(p5) {
// Define your custom preload function on the p5 prototype
p5.prototype.loadScript = function (path) {
const ret = {};
var that = this;
// Assuming Bela.control.loadResource returns a Promise
let resource = Bela.control.loadResource(path)
.then(()=>{
if (typeof that._decrementPreload === 'function') {
that._decrementPreload();
}
})
.catch(()=>{
});

return resource;
};

p5 = new p5();
return p5;
}
}
5 changes: 2 additions & 3 deletions IDE/public/js/p5.min.js

Large diffs are not rendered by default.