incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [19/19] js commit: Added NotificationProxy.js
Date Fri, 17 Aug 2012 18:54:50 GMT
Added NotificationProxy.js


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/fbafb345
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/fbafb345
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/fbafb345

Branch: refs/heads/master
Commit: fbafb345d4c7a77d579ecd97dbabd78c3c313864
Parents: 1b0e029
Author: mpberk <matthew.p.berk@intel.com>
Authored: Wed Aug 15 15:04:56 2012 -0700
Committer: mpberk <matthew.p.berk@intel.com>
Committed: Wed Aug 15 15:04:56 2012 -0700

----------------------------------------------------------------------
 lib/win8metro/exec.js                              |    3 +-
 lib/win8metro/platform.js                          |    6 +-
 lib/win8metro/plugin/win8metro/CameraProxy.js      |    4 +-
 lib/win8metro/plugin/win8metro/CaptureProxy.js     |    2 +-
 lib/win8metro/plugin/win8metro/MediaProxy.js       |   40 +++++-----
 .../plugin/win8metro/NotificationProxy.js          |   60 +++++++++++++++
 6 files changed, 90 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/fbafb345/lib/win8metro/exec.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/exec.js b/lib/win8metro/exec.js
index 68f56f2..db3f098 100644
--- a/lib/win8metro/exec.js
+++ b/lib/win8metro/exec.js
@@ -35,7 +35,8 @@ var CommandProxy  = {
     "File":require('cordova/plugin/win8metro/FileProxy'),
     "Media":require('cordova/plugin/win8metro/MediaProxy'),
     "MediaFile":require('cordova/plugin/win8metro/MediaFileProxy'),
-    "NetworkStatus":require('cordova/plugin/win8metro/NetworkStatusProxy')
+    "NetworkStatus":require('cordova/plugin/win8metro/NetworkStatusProxy'),
+    "Notification":require('cordova/plugin/win8metro/NotificationProxy')
 };
 
 var Exec = function(success, fail, service, action, args) {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/fbafb345/lib/win8metro/platform.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/platform.js b/lib/win8metro/platform.js
index 768e9bb..54886d4 100644
--- a/lib/win8metro/platform.js
+++ b/lib/win8metro/platform.js
@@ -1,7 +1,7 @@
 var cordova = require('cordova'),
     exec = require('cordova/exec'),
     channel = cordova.require("cordova/channel");
-  
+
 module.exports = {
     id: "win8metro",
     initialize:function() {
@@ -38,8 +38,12 @@ module.exports = {
                 console: {
                     path: "cordova/plugin/win8metro/console"
 
+                },
+                notification: {
+                    path: 'cordova/plugin/notification'
                 }
             }
+
         }
         //,
         // device:{

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/fbafb345/lib/win8metro/plugin/win8metro/CameraProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/CameraProxy.js b/lib/win8metro/plugin/win8metro/CameraProxy.js
index 76150db..40ad781 100644
--- a/lib/win8metro/plugin/win8metro/CameraProxy.js
+++ b/lib/win8metro/plugin/win8metro/CameraProxy.js
@@ -19,7 +19,7 @@ module.exports = {
  */
  
 "getPicture":function(successCallback, errorCallback, options) {
-	
+    
 
     // successCallback required
     if (typeof successCallback !== "function") {
@@ -388,6 +388,6 @@ module.exports = {
             errorCallback("Fail to capture a photo.");
         })
     }
-	
+    
 }
 };
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/fbafb345/lib/win8metro/plugin/win8metro/CaptureProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/CaptureProxy.js b/lib/win8metro/plugin/win8metro/CaptureProxy.js
index d6b98da..0633b29 100755
--- a/lib/win8metro/plugin/win8metro/CaptureProxy.js
+++ b/lib/win8metro/plugin/win8metro/CaptureProxy.js
@@ -1,4 +1,4 @@
-´╗┐var MediaFile = require('cordova/plugin/MediaFile');
+var MediaFile = require('cordova/plugin/MediaFile');
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/fbafb345/lib/win8metro/plugin/win8metro/MediaProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/MediaProxy.js b/lib/win8metro/plugin/win8metro/MediaProxy.js
index 0667684..392b8b7 100644
--- a/lib/win8metro/plugin/win8metro/MediaProxy.js
+++ b/lib/win8metro/plugin/win8metro/MediaProxy.js
@@ -5,9 +5,9 @@ module.exports = {
 
     // Initiates the audio file
     create:function(win, lose, args) {
-		var id = args[0];
-		var src = args[1];
-		var thisM = Media.get(id);
+        var id = args[0];
+        var src = args[1];
+        var thisM = Media.get(id);
 
         Media.prototype.node = null;
 
@@ -20,8 +20,8 @@ module.exports = {
                 thisM.node.load();
                 var dur = thisM.node.duration;
                 if (isNaN(dur)) {
-					dur = -1;
-				};
+                    dur = -1;
+                };
                 Media.onStatus(id, Media.MEDIA_DURATION, dur);
             } else {
                 lose("Invalid file type");
@@ -31,9 +31,9 @@ module.exports = {
 
     // Start playing the audio
     startPlayingAudio:function(win, lose, args) {
-		var id = args[0];
-		//var src = args[1];
-		//var options = args[2];
+        var id = args[0];
+        //var src = args[1];
+        //var options = args[2];
         (Media.get(id)).node.play();
     },
 
@@ -132,23 +132,23 @@ module.exports = {
 
     // Release the media object
     release:function(win, lose, args) {
-    	var id = args[0];
-    	var thisM = Media.get(id);
-    	try {
+        var id = args[0];
+        var thisM = Media.get(id);
+        try {
             delete thisM.node;
         } catch (err) {
             lose("Failed to release: "+err);
         }
     },
     setVolume:function(win, lose, args) {
-		var id = args[0];
-		var volume = args[1];
-		var thisM = Media.get(id);
-		thisM.volume = volume;
-	}
+        var id = args[0];
+        var volume = args[1];
+        var thisM = Media.get(id);
+        thisM.volume = volume;
+    }
 
-	//	Still need code for Media.onStatus
-	//		Need to fire event when duration is looked up
-	//								position is looked up
-	//								media is stopped
+    //    Still need code for Media.onStatus
+    //        Need to fire event when duration is looked up
+    //                                position is looked up
+    //                                media is stopped
 };

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/fbafb345/lib/win8metro/plugin/win8metro/NotificationProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/NotificationProxy.js b/lib/win8metro/plugin/win8metro/NotificationProxy.js
new file mode 100644
index 0000000..96441a8
--- /dev/null
+++ b/lib/win8metro/plugin/win8metro/NotificationProxy.js
@@ -0,0 +1,60 @@
+var cordova = require('cordova');
+
+module.exports = {
+    alert:function(win, loseX, args) {
+        var message = args[0];
+        var _title = args[1];
+        var _buttonLabel = args[2];
+
+        var md = new Windows.UI.Popups.MessageDialog(message, _title);
+        md.commands.append(new Windows.UI.Popups.UICommand(_buttonLabel));
+        md.showAsync().then(win);
+    },
+
+    confirm:function(win, loseX, args) {
+        var message = args[0];
+        var _title = args[1];
+        var _buttonLabels = args[2];
+
+		var btnList = [];
+        function commandHandler (command) {
+			win(btnList[command.label]);
+		};
+
+        var md = new Windows.UI.Popups.MessageDialog(message, _title);
+        var button = _buttonLabels.split(',');
+        var btnList = [];
+        for (var i = 0; i<button.length; i++) {
+			btnList[button[i]] = i+1;
+			md.commands.append(new Windows.UI.Popups.UICommand(button[i],commandHandler));
+		};
+        md.showAsync();
+    },
+
+    vibrate:function(winX, loseX, args) {
+        var mills = args[0];
+
+        //...
+    },
+
+    beep:function(winX, loseX, args) {
+        var count = args[0];
+        /*
+        var src = //filepath//
+        var playTime = 500; // ms
+        var quietTime = 1000; // ms
+        var media = new Media(src, function(){});
+        var hit = 1;
+        var intervalId = window.setInterval( function () {
+            media.play();
+            sleep(playTime);
+            media.stop();
+            media.seekTo(0);
+            if (hit < count) {
+                hit++;
+            } else {
+                window.clearInterval(intervalId);
+            }
+        }, playTime + quietTime); */
+    }
+};
\ No newline at end of file


Mime
View raw message