cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [3/9] js commit: [all] Use argscheck in device.js
Date Thu, 22 Nov 2012 20:47:47 GMT
[all] Use argscheck in device.js

https://issues.apache.org/jira/browse/CB-1892


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/1fe276bc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/1fe276bc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/1fe276bc

Branch: refs/heads/master
Commit: 1fe276bcb9b36ced8be236c40886a6c0dc0a1076
Parents: 4864283
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Nov 22 15:41:27 2012 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Nov 22 15:45:06 2012 -0500

----------------------------------------------------------------------
 lib/common/plugin/device.js |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/1fe276bc/lib/common/plugin/device.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/device.js b/lib/common/plugin/device.js
index a6213ea..6dd4d85 100644
--- a/lib/common/plugin/device.js
+++ b/lib/common/plugin/device.js
@@ -19,7 +19,8 @@
  *
 */
 
-var channel = require('cordova/channel'),
+var argscheck = require('cordova/argscheck'),
+    channel = require('cordova/channel'),
     utils = require('cordova/utils'),
     exec = require('cordova/exec');
 
@@ -66,20 +67,7 @@ function Device() {
  * @param {Function} errorCallback The function to call when there is an error getting the
heading data. (OPTIONAL)
  */
 Device.prototype.getInfo = function(successCallback, errorCallback) {
-
-    // successCallback required
-    if (typeof successCallback !== "function") {
-        console.log("Device Error: successCallback is not a function");
-        return;
-    }
-
-    // errorCallback optional
-    if (errorCallback && (typeof errorCallback !== "function")) {
-        console.log("Device Error: errorCallback is not a function");
-        return;
-    }
-
-    // Get info
+    argscheck.checkArgs('fF', 'Device.getInfo', arguments);
     exec(successCallback, errorCallback, "Device", "getDeviceInfo", []);
 };
 


Mime
View raw message