Sha256: bf5b3dbd6f249892d24e77b09e4c17e3b59d73bfde49aa5e4a1f834505b6660a
Contents?: true
Size: 1.5 KB
Versions: 9
Compression:
Stored size: 1.5 KB
Contents
var OneSignalPlayerId = null; var OneSignal = window.OneSignal || []; function OneSignalInit() { OneSignal.push([ 'init', { appId: '<%= DeviseOnesignal.configuration.app_id %>', autoRegister: <%= DeviseOnesignal.configuration.auto_register ? 'true' : 'false' %>, welcomeNotification: { disable: true, title: '', message: '' }, notifyButton: { enable: false }, persistNotification: <%= DeviseOnesignal.configuration.persist_notification ? 'true' : 'false' %> // Automatically dismiss the notification after ~20 seconds in Chrome Desktop v47+ }]); OneSignal.push(function() { OneSignal.getUserId().then(function(playerId) { if ( playerId != null ) { OneSignalPlayerId = playerId; document.cookie = 'oneSignalPlayerId=' + playerId; }; OneSignal.push([ 'getNotificationPermission', function(permission) { document.cookie = 'oneSignalPlayerPermission=' + permission; }]); }); }); }; function OneSignalSubscribe() { if ( OneSignalPlayerId != null ) { OneSignal.setSubscription(true); } else { OneSignal.registerForPushNotifications({ modalPrompt: <%= DeviseOnesignal.configuration.subscribe_with_modal ? 'true' : 'false' %> }); }; } function OneSignalUnsubscribe() { OneSignal.setSubscription(false); }
Version data entries
9 entries across 9 versions & 1 rubygems