| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /**
- * locale-notification.js
- * Cordova LocalNotification Plugin
- *
- * Created by Sebastian Katzer (github.com/katzer) on 10/08/2013.
- * Copyright 2013 Sebastian Katzer. All rights reserved.
- * GPL v2 licensed
- */
- var LocalNotification = function () {
- };
- LocalNotification.prototype = {
- /**
- * Fügt einen neuen Eintrag zur Registry hinzu.
- *
- * @param {Object} options
- */
- add: function (options) {
- var defaults = {
- date: false,
- message: '',
- hasAction: true,
- action: 'View',
- badge: 0,
- id: 0,
- sound: '',
- background: '',
- foreground: ''
- };
- for (var key in defaults) {
- if (options[key] !== undefined) {
- defaults[key] = options[key];
- }
- }
- if (typeof defaults.date == 'object') {
- defaults.date = Math.round(defaults.date.getTime()/1000);
- }
- cordova.exec(null, null, 'LocalNotification','add', [defaults]);
- },
- /**
- * Entfernt die angegebene Notification.
- *
- * @param {String} id
- */
- cancel: function (id) {
- cordova.exec(null, null, 'LocalNotification', 'cancel', [id]);
- },
- /**
- * Entfernt alle registrierten Notifications.
- */
- cancelAll: function () {
- cordova.exec(null, null, 'LocalNotification', 'cancelAll', []);
- }
- };
- var plugin = new LocalNotification();
- module.exports = plugin;
|