You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/04/06 03:20:43 UTC

[29/40] git commit: added cordovaCommandResult called from native

added cordovaCommandResult called from native


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

Branch: refs/heads/master
Commit: 07c9c2ba986d0942216971030676fefb894e4a73
Parents: ddf3adf
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Feb 23 19:33:52 2012 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Mar 28 16:01:23 2012 -0700

----------------------------------------------------------------------
 lib/plugin/wp7/cordovaCommandResult.js |   33 +++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/07c9c2ba/lib/plugin/wp7/cordovaCommandResult.js
----------------------------------------------------------------------
diff --git a/lib/plugin/wp7/cordovaCommandResult.js b/lib/plugin/wp7/cordovaCommandResult.js
new file mode 100644
index 0000000..8e7c906
--- /dev/null
+++ b/lib/plugin/wp7/cordovaCommandResult.js
@@ -0,0 +1,33 @@
+
+
+var cordova = require('cordova');
+
+module.exports = {
+	// singular WP7 callback function attached to window, status is used to determin if it is a success or error
+	CordovaCommandResult:function(status,callbackId,args,cast) {
+		if(status === "backbutton") {
+			cordova.fireEvent(document,"backbutton");
+			return "true";
+		} 
+		else if(status === "resume") {
+			cordova.onResume.fire();
+			return "true";
+		} 
+		else if(status === "pause") {
+		
+			cordova.onPause.fire();
+			return "true";  
+		}
+		
+		var safeStatus = parseInt(status, 10);
+		if(safeStatus === cordova.callbackStatus.NO_RESULT ||
+		   safeStatus === cordova.callbackStatus.OK) {
+			cordova.CallbackSuccess(callbackId,args,cast);
+		}
+		else
+		{
+			cordova.CallbackError(callbackId,args,cast);
+		}
+	}
+
+}
\ No newline at end of file