incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [10/15] git commit: adding notifications
Date Fri, 20 Apr 2012 00:21:40 GMT
adding notifications


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/71214ef3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/71214ef3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/71214ef3

Branch: refs/heads/master
Commit: 71214ef3f600c2781be398b5a9056dfe599e0786
Parents: 24c880f
Author: Anis Kadri <anis.kadri@gmail.com>
Authored: Thu Apr 19 17:13:13 2012 -0700
Committer: Anis Kadri <anis.kadri@gmail.com>
Committed: Thu Apr 19 17:13:13 2012 -0700

----------------------------------------------------------------------
 lib/bada/exec.js                     |    3 +-
 lib/bada/plugin/bada/Notification.js |   50 +++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/71214ef3/lib/bada/exec.js
----------------------------------------------------------------------
diff --git a/lib/bada/exec.js b/lib/bada/exec.js
index 1c78a9c..93627ac 100644
--- a/lib/bada/exec.js
+++ b/lib/bada/exec.js
@@ -1,7 +1,8 @@
 var plugins = {
     "Device": require('cordova/plugin/bada/device'),
     "NetworkStatus": require('cordova/plugin/bada/NetworkStatus'),
-    "Accelerometer": require('cordova/plugin/bada/Accelerometer')
+    "Accelerometer": require('cordova/plugin/bada/Accelerometer'),
+    "Notification": require('cordova/plugin/bada/Notification')
 };
 
 module.exports = function(success, fail, service, action, args) {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/71214ef3/lib/bada/plugin/bada/Notification.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Notification.js b/lib/bada/plugin/bada/Notification.js
new file mode 100644
index 0000000..35e4612
--- /dev/null
+++ b/lib/bada/plugin/bada/Notification.js
@@ -0,0 +1,50 @@
+module.exports = {
+    alert: function(message, alertCallback, title, buttonName) {
+        alert(message);
+    },
+    confirm: function(message, confirmCallback, title, buttonLabels) {
+        alert(message);
+    },
+    beep: function(times, milliseconds) {
+        try {
+            deviceapis.deviceinteraction.stopNotify();
+            if(times == 0) {
+                return;
+            }
+            deviceapis.deviceinteraction.startNotify(function() {
+                console.log("Notifying");
+            },
+            function(e) {
+                console.log("Failed to notify: " + e);
+            },
+            milliseconds);
+            Osp.Core.Function.delay(this.beep, 1000+milliseconds, this, times - 1, milliseconds);
+        }
+        catch(e) {
+            console.log("Exception thrown: " + e);
+        }
+    },
+    vibrate: function(milliseconds) {
+        try {
+            deviceapis.deviceinteraction.startVibrate(function() {
+                console.log("Vibrating...");
+            },
+            function(e) {
+                console.log("Failed to vibrate: " + e);
+            },
+            milliseconds);
+        }
+        catch(e) {
+            console.log("Exception thrown: " + e);
+        }
+        },
+    lightOn: function(milliseconds) {
+        deviceapis.deviceinteraction.lightOn(function() {
+            console.log("Lighting for "+milliseconds+" second");
+        },
+        function() {
+            console.log("Failed to light");
+        },
+        milliseconds);
+    }
+};


Mime
View raw message