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/08/15 01:54:56 UTC
[4/9] js commit: Exec json encodes all non-string arg items
Exec json encodes all non-string arg items
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/ed519925
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/ed519925
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/ed519925
Branch: refs/heads/master
Commit: ed519925ce9c69881ce2a86297bfa296e7e82689
Parents: eda0243
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Aug 14 16:32:36 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Aug 14 16:32:36 2012 -0700
----------------------------------------------------------------------
lib/wp7/exec.js | 7 ++++
lib/wp7/plugin/wp7/DirectoryEntry.js | 50 -----------------------------
2 files changed, 7 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/ed519925/lib/wp7/exec.js
----------------------------------------------------------------------
diff --git a/lib/wp7/exec.js b/lib/wp7/exec.js
index 3f59f5b..92baf49 100644
--- a/lib/wp7/exec.js
+++ b/lib/wp7/exec.js
@@ -23,6 +23,13 @@ module.exports = function(success, fail, service, action, args) {
cordova.callbacks[callbackId] = {success:success, fail:fail};
}
// generate a new command string, ex. DebugConsole/log/DebugConsole23/["wtf dude?"]
+ for(var n = 0; n < args.length; n++)
+ {
+ if(typeof args[n] !== "string")
+ {
+ args[n] = JSON.stringify(args[n]);
+ }
+ }
var command = service + "/" + action + "/" + callbackId + "/" + JSON.stringify(args);
// pass it on to Notify
try {
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/ed519925/lib/wp7/plugin/wp7/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/lib/wp7/plugin/wp7/DirectoryEntry.js b/lib/wp7/plugin/wp7/DirectoryEntry.js
deleted file mode 100644
index 4c1a4cb..0000000
--- a/lib/wp7/plugin/wp7/DirectoryEntry.js
+++ /dev/null
@@ -1,50 +0,0 @@
-
-var DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
- exec = require('cordova/exec'),
- FileError = require('cordova/plugin/FileError');
-
-// Note, this is a special case, we need to overwrite the functions getDirectory + getFile.
-// Entry uses require at runtime, and will not find our patched version of the funks
-// so we have to overwrite the prototype manually -jm
-// In this case there is nothing to export.
-
-/**
- * Creates or looks up a directory
- *
- * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a directory
- * @param {Flags} options to create or excluively create the directory
- * @param {Function} successCallback is called with the new entry
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryEntry.prototype.getDirectory = function(path, options, successCallback, errorCallback) {
-
- var win = typeof successCallback !== 'function' ? null : function(result) {
- var entry = new DirectoryEntry(result.name, result.fullPath);
- successCallback(entry);
- };
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
- errorCallback(new FileError(code));
- };
- exec(win, fail, "File", "getDirectory", [this.fullPath, path, JSON.stringify(options)]);
-};
-
-/**
- * Creates or looks up a file
- *
- * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a file
- * @param {Flags} options to create or excluively create the file
- * @param {Function} successCallback is called with the new entry
- * @param {Function} errorCallback is called with a FileError
- */
-DirectoryEntry.prototype.getFile = function(path, options, successCallback, errorCallback) {
-
- var win = typeof successCallback !== 'function' ? null : function(result) {
- var FileEntry = require('cordova/plugin/FileEntry');
- var entry = new FileEntry(result.name, result.fullPath);
- successCallback(entry);
- };
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
- errorCallback(new FileError(code));
- };
- exec(win, fail, "File", "getFile", [this.fullPath, path, JSON.stringify(options)]);
-};