Small improvements

This commit is contained in:
Kurt Hutten
2020-11-21 05:35:43 +11:00
parent bebe4de360
commit bc8a45d392
3 changed files with 39 additions and 26 deletions

View File

@@ -15,6 +15,37 @@ import './index.css'
netlifyIdentity.init()
function initCascadeStudio() {
// if ('serviceWorker' in navigator) {
// navigator.serviceWorker.register('service-worker.js').then(function(registration) {
// registration.update(); // Always update the registration for the latest assets
// }, function() {
// console.log('Could not register Cascade Studio for offline use!');
// });
// } else {
// console.log('Browser does not support offline access!');
// }
// Begins loading the CAD Kernel Web Worker
if (window.Worker) {
cascadeStudioWorker = new Worker('/CADWorker/CascadeStudioMainWorker.js')
// Ping Pong Messages Back and Forth based on their registration in messageHandlers
// var messageHandlers = {};
cascadeStudioWorker.onmessage = function (e) {
if (e.data.type in messageHandlers) {
let response = messageHandlers[e.data.type](e.data.payload)
if (response) {
cascadeStudioWorker.postMessage({
type: e.data.type,
payload: response,
})
}
}
}
}
}
initCascadeStudio()
ReactDOM.render(
<FatalErrorBoundary page={FatalErrorPage}>
<AuthProvider client={netlifyIdentity} type="netlify">