navigator.serviceWorker.ready.then((reg) => {
reg.pushManager.subscribe({ userVisibleOnly: true }).then((subscription) => {
console.log(subscription.endpoint);
// At this point you would most likely send the subscription
// endpoint to your server, save it, then use it to send a
// push message at a later date
});
});PushSubscription: endpoint property / notebook
PushSubscription: endpoint property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.