A Pen by Captain Anonymous on CodePen.
Please note that this is just my 2 cents to the service worker topic. It could be outdated, deprecated or overly complicated.
Files:
- The actual service worker (serviceworker.js)
- your existing JS on your page (e.g. main.js)
In main.js, the service worker gets installed like this:
const serviceWorkerUri = '/serviceworker-v1.9.js';
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Global CSS variables for Neos.Ui | |
const config = { | |
zIndex: { | |
// group by stacking context. All root properties of zIndex have "html" as parentStackingContext | |
secondaryToolbar: { | |
linkIconButtonFlyout: '1' | |
}, | |
flashMessageContainer: { | |
context: '1' | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateKey(keyName, subscription) { | |
var rawKey; | |
rawKey = subscription.getKey ? subscription.getKey(keyName) : ''; | |
return rawKey ? | |
btoa(String.fromCharCode.apply(null, new Uint8Array(rawKey))) : | |
''; | |
} | |
export function generatePublicKey(subscription) { | |
return Promise.resolve(generateKey('p256dh', subscription)); |