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:40 UTC
[3/6] cordova-plugins git commit: notification plugin initiation,
not ready for anything state
notification plugin initiation, not ready for anything state
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugins/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugins/commit/e25ff7c2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugins/tree/e25ff7c2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugins/diff/e25ff7c2
Branch: refs/heads/master
Commit: e25ff7c20e8b16b3205fdbca9ffb673db117e876
Parents: bb16356
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Tue Nov 25 16:32:20 2014 +0100
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Dec 8 17:02:11 2016 -0800
----------------------------------------------------------------------
notification/README.md | 2 +
notification/plugin.xml | 29 ++++++++++++++
notification/src/firefoxos/notification.js | 26 +++++++++++++
notification/www/notification.js | 50 +++++++++++++++++++++++++
4 files changed, 107 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/e25ff7c2/notification/README.md
----------------------------------------------------------------------
diff --git a/notification/README.md b/notification/README.md
new file mode 100644
index 0000000..a52d36f
--- /dev/null
+++ b/notification/README.md
@@ -0,0 +1,2 @@
+Notification
+=====
http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/e25ff7c2/notification/plugin.xml
----------------------------------------------------------------------
diff --git a/notification/plugin.xml b/notification/plugin.xml
new file mode 100644
index 0000000..62c18c0
--- /dev/null
+++ b/notification/plugin.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
+ xmlns:rim="http://www.blackberry.com/ns/widgets"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ id="org.apache.cordova.labs.notification"
+ version="0.0.1">
+ <name>Notification</name>
+ <description>Cordova Notification Plugin</description>
+ <license>Apache 2.0</license>
+ <keywords>cordova,notification</keywords>
+
+ <engines>
+ <engine name="cordova" version=">=4.0.0" />
+ </engines>
+
+ <js-module src="www/notification.js" name="notification">
+ <clobbers target="window.Notification" />
+ </js-module>
+
+ <!-- firefoxos -->
+ <platform name="firefoxos">
+ <permission name="desktop-notification" description="Your reason here">
+ <js-module src="src/firefoxos/NotificationProxy.js" name="NotificationProxy">
+ <runs />
+ </js-module>
+ </platform>
+
+</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/e25ff7c2/notification/src/firefoxos/notification.js
----------------------------------------------------------------------
diff --git a/notification/src/firefoxos/notification.js b/notification/src/firefoxos/notification.js
new file mode 100644
index 0000000..de56562
--- /dev/null
+++ b/notification/src/firefoxos/notification.js
@@ -0,0 +1,26 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var modulemapper = require('cordova/modulemapper');
+var Notification = require('./Notification');
+
+var mozNotification = modulemapper.getOriginalSymbol(window, 'window.Notification');
+
http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/e25ff7c2/notification/www/notification.js
----------------------------------------------------------------------
diff --git a/notification/www/notification.js b/notification/www/notification.js
new file mode 100644
index 0000000..b6f898a
--- /dev/null
+++ b/notification/www/notification.js
@@ -0,0 +1,50 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var argscheck = require('cordova/argscheck'),
+ utils = require('cordova/utils'),
+ exec = require('cordova/exec');
+
+
+// This might not be the best option
+// from http://stackoverflow.com/questions/22186467/how-to-use-javascript-eventtarget
+
+function Emitter () {
+ var eventTarget = document.createDocumentFragment();
+
+ function delegate (method) {
+ this[method] = eventTarget[method].bind(eventTarget);
+ }
+
+ Emitter.methods.forEach(delegate, this);
+}
+
+Emitter.methods = ["addEventListener", "dispatchEvent", "removeEventListener"];
+
+function Notification () {
+ Emitter.call(this);
+}
+
+Notifcation.close = function(fields, successCB, errorCB, options) {
+ exec(successCB, errorCB, "Notification", "close", [fields, options]);
+};
+
+module.exports = Notification;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org