-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcocoon_notifications_local.js
35 lines (31 loc) · 1.42 KB
/
cocoon_notifications_local.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(function(){
if (window.cordova && typeof require !== 'undefined') {
require('cocoon-plugin-notifications-common.Notifications'); //force dependency load
}
var Cocoon = window.Cocoon;
/**
* This namespace represents the Cocoon Notification extension for local notifications
* @namespace Cocoon.Notification.Local
*
* @example
* //Set up notification listener
* Cocoon.Notification.Local.on(notification, function(userData){
* console.log("A local notification has been received: " + JSON.stringify(userData));
* });
*
* // Initialize the service. Ready to start receiving notification callbacks
* // The service will be automatically registered after the initialization. This may show a Dialog to request user permissions.
* // You can disable autoregister with {register: false} params and call Cocoon.Notification.Local.register() manually to control when the permissions dialog is shown.
* // By default the register parameter is set to true.
*
* Cocoon.Notification.Local.initialize({register: false}, function(registered) {
* if (!registered) {
* alert('Local notifications disabled by user')
* }
* })
*/
Cocoon.define("Cocoon.Notification", function(extension) {
extension.Local = new Cocoon.Notification.NotificationService('LDNotificationLocalPlugin');
return extension;
});
})();