View all newsletters
Receive our newsletter - data, insights and analysis delivered to you
  1. Uncategorised
March 25, 2020

Unsubscribe from push notifications

By Chris Boyle

element.removeEventListener('click', onManageWebPushSubscriptionButtonClicked); element.addEventListener('click', onManageWebPushSubscriptionButtonClicked); element.textContent = buttonText;

if (state.hideWhenSubscribed && state.isPushEnabled) { = "none"; } else { = ""; } }); }

function getSubscriptionState() { return Promise.all([ OneSignal.isPushNotificationsEnabled(), OneSignal.isOptedOut() ]).then(function(result) { var isPushEnabled = result[0]; var isOptedOut = result[1];

return { isPushEnabled: isPushEnabled, isOptedOut: isOptedOut }; }); }

var OneSignal = OneSignal || []; var buttonSelector = "#my-notification-button";

/* This example assumes you've already initialized OneSignal */ OneSignal.push(function() { // If we're on an unsupported browser, do nothing if (!OneSignal.isPushNotificationsSupported()) { return; } updateMangeWebPushSubscriptionButton(buttonSelector); OneSignal.on("subscriptionChange", function(isSubscribed) { /* If the user's subscription state changes during the page's session, update the button text */ updateMangeWebPushSubscriptionButton(buttonSelector); }); });

Related Companies

NEWSLETTER Sign up Tick the boxes of the newsletters you would like to receive. A weekly roundup of the latest news and analysis, sent every Friday. The pharmaceutical industry's most comprehensive news and information delivered every month.
I consent to GlobalData UK Limited collecting my details provided via this form in accordance with the Privacy Policy


Thank you for subscribing to Pharmaceutical Technology