Moving data migration outside of DOMContentLoaded

pull/327/head
Kevin Payravi 2023-11-05 04:21:33 -06:00
parent a399a86528
commit 342842cd83
2 changed files with 8 additions and 8 deletions

View File

@ -330,9 +330,6 @@ function setBreezeWiki(setting, storeSetting = true) {
// Main function that runs on-load // Main function that runs on-load
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
// Run v3 data migration:
migrateData();
// If running Chromium, show warning about service worker bug // If running Chromium, show warning about service worker bug
if (navigator.userAgent.match(/Chrom[e|ium]/)) { if (navigator.userAgent.match(/Chrom[e|ium]/)) {
const notificationBannerChromeBug = document.getElementById('notificationBannerChromeBug'); const notificationBannerChromeBug = document.getElementById('notificationBannerChromeBug');
@ -457,3 +454,6 @@ document.addEventListener('DOMContentLoaded', function () {
}); });
}); });
}); });
// Run v3 data migration:
migrateData();

View File

@ -27,7 +27,7 @@ function resetOptions() {
// Get wiki data from data folder // Get wiki data from data folder
async function getData() { async function getData() {
var sites = []; let sites = [];
let promises = []; let promises = [];
for (let i = 0; i < LANGS.length; i++) { for (let i = 0; i < LANGS.length; i++) {
promises.push(fetch(chrome.runtime.getURL('data/sites' + LANGS[i] + '.json')) promises.push(fetch(chrome.runtime.getURL('data/sites' + LANGS[i] + '.json'))
@ -672,9 +672,6 @@ async function migrateData() {
// Main function that runs on-load // Main function that runs on-load
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
// Run v3 data migration:
migrateData();
// If newly installed, show initial install guide // If newly installed, show initial install guide
if (new URLSearchParams(window.location.search).get('newinstall')) { if (new URLSearchParams(window.location.search).get('newinstall')) {
document.getElementById('firstInstallInfo').style.display = 'block'; document.getElementById('firstInstallInfo').style.display = 'block';
@ -846,3 +843,6 @@ document.addEventListener('DOMContentLoaded', function () {
document.getElementById('countBreezeWiki').textContent = item[key]; document.getElementById('countBreezeWiki').textContent = item[key];
}); });
}); });
// Run v3 data migration:
migrateData();