addCommandProxy+removeCommandProxy
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/a55eb34c Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/a55eb34c Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/a55eb34c Branch: refs/heads/master Commit: a55eb34cf85fe0f328a5f6f7ea5ba43d67b3aec5 Parents: b8fae99 Author: purplecabbage <purplecabb...@gmail.com> Authored: Tue Jul 31 12:39:07 2012 -0700 Committer: purplecabbage <purplecabb...@gmail.com> Committed: Tue Jul 31 12:39:07 2012 -0700 ---------------------------------------------------------------------- lib/win8metro/exec.js | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/a55eb34c/lib/win8metro/exec.js ---------------------------------------------------------------------- diff --git a/lib/win8metro/exec.js b/lib/win8metro/exec.js index e03151d..992f2e8 100644 --- a/lib/win8metro/exec.js +++ b/lib/win8metro/exec.js @@ -35,7 +35,7 @@ var CommandProxy = { "NetworkStatus":require('cordova/plugin/win8metro/NetworkStatusProxy') }; -var Exec = function(success, fail, service, action, args) { +module.exports = function(success, fail, service, action, args) { if(CommandProxy[service] && CommandProxy[service][action]) { @@ -60,12 +60,22 @@ var Exec = function(success, fail, service, action, args) { }; -Exec.addCommandProxy = function(id,proxyObj) { +// cordova.exec.addCommandProxy("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...); +module.exports.addCommandProxy = function(id,proxyObj) { CommandProxy[id] = proxyObj; }; -module.exports = Exec; +// cordova.exec.removeCommandProxy("Accelerometer"); +module.exports.removeCommandProxy = function(id) { + + var proxy = CommandProxy[id]; + delete CommandProxy[id]; + CommandProxy[id] = null; + return proxy; +}; + +