So let's pretend that I have a index.js file with the following scenarios. The file is imported in the index.html file, and it will trigger what is inside of that file. Can I expect the following snippets to behave differently or behave the same? I see the same results, but might as well ask :)
scenario 1
(() => {
navigator.serviceWorker.register("sw.js").then(() => {
console.log('sw registered');
});
})();
scaneario 2
registerServiceWorker();
function registerServiceWorker() {
navigator.serviceWorker.register("sw.js").then(() => {
console.log('sw registered');
});
}
scenario 3
navigator.serviceWorker.register("sw.js").then(() => {
console.log('sw registered');
});