You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/05/17 19:53:31 UTC

[13/26] js commit: [Tizen, Tizen SDk 2.0 (Magnolia)] - Notification

[Tizen, Tizen SDk 2.0 (Magnolia)] - Notification

Add basic support for Prompt() based on using window.prompt()


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

Branch: refs/heads/3.0.0
Commit: a7aaeee48d48a94c7f2e0d7a3bc628654da05b70
Parents: a26b43d
Author: pplaquette <pp...@apache.org>
Authored: Wed Apr 17 15:28:55 2013 +0200
Committer: pplaquette <pp...@apache.org>
Committed: Fri Apr 19 11:07:14 2013 +0200

----------------------------------------------------------------------
 lib/tizen/plugin/tizen/Notification.js |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/a7aaeee4/lib/tizen/plugin/tizen/Notification.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Notification.js b/lib/tizen/plugin/tizen/Notification.js
index 3819fcd..b5c90c6 100644
--- a/lib/tizen/plugin/tizen/Notification.js
+++ b/lib/tizen/plugin/tizen/Notification.js
@@ -124,6 +124,24 @@ module.exports = {
            element.addEventListener("click", createListener(element), false);
        }
     },
+    
+    prompt: function (message, promptCallback, title, buttonLabels) {
+        console.log ("message" , message);
+        console.log ("confirmCallback" , promptCallback);
+        console.log ("title" , title);
+        console.log ("buttonLabels" , buttonLabels);
+
+        //a temporary implementation using window.prompt()
+        // note taht buttons are cancel ok (in that order)
+        // gonna to return based on having OK  / Cancel
+        // ok is 1, cancel is 2
+
+        var result = prompt(message);
+        
+        if (promptCallback && (typeof promptCallback == "function")) {
+            promptCallback((result === null) ? 2 : 1, result);
+        }
+    },
 
     vibrate: function(milliseconds) {
         console.log ("milliseconds" , milliseconds);