Permalink
Browse files

[all] Use argscheck in device.js

  • Loading branch information...
agrieve committed Nov 22, 2012
1 parent 4864283 commit 1fe276bcb9b36ced8be236c40886a6c0dc0a1076
Showing with 3 additions and 15 deletions.
  1. +3 −15 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", []);
};

0 comments on commit 1fe276b

Please sign in to comment.