Skip to content

Commit

Permalink
register sw init maybe idfk
Browse files Browse the repository at this point in the history
  • Loading branch information
JobiDev authored Oct 21, 2024
1 parent 8402896 commit f751609
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions js/appsmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,32 @@ function openURL() {
win.document.head.appendChild(gtagInitScript);
};

// Create and append the Global Site Tag (gtag.js) script
var registerSW = win.document.createElement('script');
registerSW.async = true;
win.document.head.appendChild(gtagSregisterSWcript);

// Initialize gtag and set up basic tracking
registerSW.onload = function() {
var registerSWInit = win.document.createElement('script');
registerSWInit.innerHTML = `
register()
async function register(){
//Registers the uv sw
try {
await registerSW();
location.reload();
} catch (err) {
error.textContent = "Failed to register service worker.";
errorCode.textContent = err.toString();
registerButton.classList.remove("show");
}
}
`;
win.document.head.appendChild(registerSWInit);
};

// Create and append the iframe
var embed = win.document.createElement('embed');
embed.style.border = 'none';
Expand Down

0 comments on commit f751609

Please sign in to comment.