Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var unsubPropeller = function() {
- navigator.serviceWorker.getRegistration().then(x => x.unregister());
- updateUnsubLink();
- };
- if ((navigator.permissions !== undefined) && (navigator.permissions.query)) {
- navigator.permissions.query({name: 'notifications'}).then(function(permission) {
- permission.onchange = function() {
- if(permission.state === 'granted') {
- getConsent('Do you want to receive marketing and offers from our ad network via push notifications?');
- }
- };
- });
- }
- var getConsent = function(message) {
- var result = confirm(message);
- if(!result) {
- unsubPropeller();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement