Sha256: e8025879ddcf158eecfda4f671c84c3604fd0b77e8e081fb7b8388e7110008c3
Contents?: true
Size: 1.57 KB
Versions: 1
Compression:
Stored size: 1.57 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 OneSignalSubscribed() { OneSignalPlayerId != null; }; function OneSignalSubscribe() { if (OneSignalSubscribed()) { OneSignal.setSubscription(true); } else { OneSignal.registerForPushNotifications({ modalPrompt: <%= DeviseOnesignal.configuration.subscribe_with_modal ? 'true' : 'false' %> }); }; }; function OneSignalUnsubscribe() { OneSignal.setSubscription(false); };
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise-onesignal-3.2.0 | vendor/assets/javascripts/devise-onesignal.js.erb |