Make dendrite load again

This commit is contained in:
Kegan Dougal 2020-03-26 12:33:31 +00:00
parent 52641c5674
commit cdd32590fe
3 changed files with 6 additions and 8 deletions

View File

@ -186,9 +186,10 @@ export async function loadApp() {
MatrixClientPeg.setIndexedDbWorkerScript(vectorIndexeddbWorkerScript); MatrixClientPeg.setIndexedDbWorkerScript(vectorIndexeddbWorkerScript);
// load dendrite, if available // load dendrite, if available
if (window.vector_dendrite_worker_script && 'serviceWorker' in navigator) { const vectorDendriteWorkerScript = document.body.dataset.vectorDendriteWorkerScript;
if (vectorDendriteWorkerScript && 'serviceWorker' in navigator) {
window.addEventListener('load', ()=>{ window.addEventListener('load', ()=>{
navigator.serviceWorker.register(window.vector_dendrite_worker_script, { scope: "/" }).then(function(registration) { navigator.serviceWorker.register(vectorDendriteWorkerScript, { scope: "/" }).then(function(registration) {
// Registration was successful // Registration was successful
console.log('ServiceWorker sw.js registration successful with scope: ', registration.scope); console.log('ServiceWorker sw.js registration successful with scope: ', registration.scope);
/* const currWorker = registration.active; /* const currWorker = registration.active;

View File

@ -1,4 +1,3 @@
// -*- coding: utf-8 -*-
// Copyright 2020 The Matrix.org Foundation C.I.C. // Copyright 2020 The Matrix.org Foundation C.I.C.
// Copyright 2020 New Vector Ltd // Copyright 2020 New Vector Ltd
// //

View File

@ -49,12 +49,10 @@
<% } <% }
} %> } %>
</head> </head>
<body style="height: 100%;" data-vector-indexeddb-worker-script="<%= htmlWebpackPlugin.files.chunks['indexeddb-worker'].entry %>"> <body style="height: 100%;"
data-vector-indexeddb-worker-script="<%= htmlWebpackPlugin.files.chunks['indexeddb_worker'].entry %>"
data-vector-dendrite-worker-script="<%= htmlWebpackPlugin.files.chunks['dendrite_sw'].entry %>">
<noscript>Sorry, Riot requires JavaScript to be enabled.</noscript> <!-- TODO: Translate this? --> <noscript>Sorry, Riot requires JavaScript to be enabled.</noscript> <!-- TODO: Translate this? -->
<script>
window.vector_indexeddb_worker_script = '<%= htmlWebpackPlugin.files.chunks['indexeddb_worker'].entry %>';
window.vector_dendrite_worker_script = '<%= htmlWebpackPlugin.files.chunks['dendrite_sw'].entry %>';
</script>
<section id="matrixchat" style="height: 100%; overflow: auto;"></section> <section id="matrixchat" style="height: 100%; overflow: auto;"></section>
<script src="<%= htmlWebpackPlugin.files.chunks['bundle'].entry %>"></script> <script src="<%= htmlWebpackPlugin.files.chunks['bundle'].entry %>"></script>
<img src="<%= require('matrix-react-sdk/res/img/warning.svg') %>" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/> <img src="<%= require('matrix-react-sdk/res/img/warning.svg') %>" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>