setupAssets to load assets after setup()

This commit is contained in:
Ruben van de Ven 2020-09-25 16:20:30 +02:00
parent fce40f28bb
commit f7a54b2e17
2 changed files with 6 additions and 1 deletions

View file

@ -382,6 +382,7 @@ class PreviewFrame extends React.Component {
// doc.contentWindow.postMessage({ 'action': 'code', 'contents': file.content }, '*');
const srcEl = doc.contentWindow.document.createElement('script');
srcEl.src = `${file.name}?changed=${updatevar}`;
srcEl.onload = 'setupAssets();'; // (re)load assets
headEl.appendChild(srcEl);
});
}

View file

@ -97,7 +97,9 @@ const detection_options = {
TinyFaceDetectorModel: window.parent.location.origin + '/assets/faceapi',
}
function setupAssets(){
// placeholder. Override in patch...
}
function setup() {
// createCanvas(1280,720, WEBGL);
@ -126,6 +128,8 @@ function setup() {
video.hide(); // Hide the video element, and just show the canvas
faceapi = ml5.faceApi(video, detection_options, modelReady);
textAlign(RIGHT);
setupAssets();
}
function modelReady() {