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

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

Branch: refs/heads/master
Commit: 45dd6d3acb5691cc2c40149cf9e9f8dbb1d2ea2f
Parents: c49de58
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Feb 23 19:33:52 2012 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Feb 23 19:33:52 2012 -0800

----------------------------------------------------------------------
 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/45dd6d3a/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