You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2016/12/09 00:59:39 UTC
[2/6] cordova-plugins git commit: fixed plugins
fixed plugins
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugins/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugins/commit/0bec51f4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugins/tree/0bec51f4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugins/diff/0bec51f4
Branch: refs/heads/master
Commit: 0bec51f4f6577f20d60612f6d2d083de6b36cd81
Parents: 4d62297
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Fri Feb 20 14:22:27 2015 +0100
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Dec 8 17:02:11 2016 -0800
----------------------------------------------------------------------
notification/plugin.xml | 8 ++++----
notification/src/firefoxos/notification.js | 16 ++++++++++------
notification/www/notification.js | 11 ++++++-----
3 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/0bec51f4/notification/plugin.xml
----------------------------------------------------------------------
diff --git a/notification/plugin.xml b/notification/plugin.xml
index fa88e1e..4436ca9 100644
--- a/notification/plugin.xml
+++ b/notification/plugin.xml
@@ -14,8 +14,8 @@
<engine name="cordova" version=">=3.6.0" />
</engines>
- <js-module src="www/notification.js" name="notification">
- <clobbers target="window.CNotification" />
+ <js-module src="www/notification.js" name="Notification">
+ <clobbers target="window.Notification" />
</js-module>
<!-- firefoxos -->
@@ -23,8 +23,8 @@
<config-file target="config.xml" parent="/*">
<permission name="desktop-notification" description="Cordova default message" />
</config-file>
- <js-module src="src/firefoxos/notification.js" name="firefoxCNotification">
- <merges target="window.CNotification" />
+ <js-module src="src/firefoxos/notification.js" name="firefoxNotification">
+ <runs />
</js-module>
</platform>
http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/0bec51f4/notification/src/firefoxos/notification.js
----------------------------------------------------------------------
diff --git a/notification/src/firefoxos/notification.js b/notification/src/firefoxos/notification.js
index 3236008..59279c2 100644
--- a/notification/src/firefoxos/notification.js
+++ b/notification/src/firefoxos/notification.js
@@ -38,8 +38,12 @@ function makeNotification(successCB, errorCB, options) {
// errors currently reporting String for debug only
function create(successCB, errorCB, options) {
+ console.log('FxOS DEBUG: create', options);
+ successCB = (successCB) ? successCB : function() {};
+ errorCB = (errorCB) ? errorCB : function() {};
+
if (mozNotification.permission === 'denied') {
- errorCB('FFOS Notification: Permission denied');
+ errorCB('FxOS Notification: Permission denied');
return;
}
if (mozNotification.permission === 'granted') {
@@ -50,17 +54,17 @@ function create(successCB, errorCB, options) {
if (permission === 'granted') {
makeNotification(successCB, errorCB, options);
} else {
- errorCB('FFOS Notification: User denied');
+ errorCB('FxOS Notification: User denied');
}
});
}
function remove(successCB, errorCB, params) {
+ successCB = (successCB) ? successCB : function() {};
+ errorCB = (errorCB) ? errorCB : function() {};
var nId = params.notificationId;
mozNotifications[nId].close();
- if (successCB) {
- successCB();
- }
+ successCB();
}
@@ -69,4 +73,4 @@ module.exports = {
remove: remove
};
-require("cordova/firefoxos/commandProxy").add("CNotification", module.exports);
+require("cordova/exec/proxy").add("Notification", module.exports);
http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/0bec51f4/notification/www/notification.js
----------------------------------------------------------------------
diff --git a/notification/www/notification.js b/notification/www/notification.js
index 13247a6..7c26c2c 100644
--- a/notification/www/notification.js
+++ b/notification/www/notification.js
@@ -41,8 +41,9 @@ function Emitter () {
Emitter.methods = ["addEventListener", "dispatchEvent", "removeEventListener"];
-function CNotification(title, options, successCB, errorCB) {
+function Notification(title, options, successCB, errorCB) {
// add emitter methods to Notification
+ console.log('DEBUG: Notification created', title, options);
var self = this;
function success() {
successCB(self);
@@ -50,12 +51,12 @@ function CNotification(title, options, successCB, errorCB) {
Emitter.call(this);
this.title = options.title = title;
this.notificationId = options.notificationId = nId++;
- exec(success, errorCB, "CNotification", "create", options);
+ exec(success, errorCB, "Notification", "create", options);
}
-CNotification.prototype.close = function(successCB, errorCB) {
+Notification.prototype.close = function(successCB, errorCB) {
var options = {notificationId: this.notificationId};
- exec(successCB, errorCB, "CNotification", "remove", options);
+ exec(successCB, errorCB, "Notification", "remove", options);
};
-module.exports = CNotification;
+module.exports = Notification;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org