You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2012/11/22 21:47:47 UTC

[6/9] js commit: [all] Use argscheck in requestFileSystem.js

[all] Use argscheck in requestFileSystem.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/ee4a70cc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/ee4a70cc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/ee4a70cc

Branch: refs/heads/master
Commit: ee4a70cce10fadd7a7563eb2941f231c9841d009
Parents: 1fe276b
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Nov 22 15:41:39 2012 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Nov 22 15:45:06 2012 -0500

----------------------------------------------------------------------
 lib/common/plugin/requestFileSystem.js |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ee4a70cc/lib/common/plugin/requestFileSystem.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/requestFileSystem.js b/lib/common/plugin/requestFileSystem.js
index b0f5fa2..2eaecb6 100644
--- a/lib/common/plugin/requestFileSystem.js
+++ b/lib/common/plugin/requestFileSystem.js
@@ -19,7 +19,8 @@
  *
 */
 
-var FileError = require('cordova/plugin/FileError'),
+var argscheck = require('cordova/argscheck'),
+    FileError = require('cordova/plugin/FileError'),
     FileSystem = require('cordova/plugin/FileSystem'),
     exec = require('cordova/exec');
 
@@ -31,10 +32,9 @@ var FileError = require('cordova/plugin/FileError'),
  * @param errorCallback  invoked if error occurs retrieving file system
  */
 var requestFileSystem = function(type, size, successCallback, errorCallback) {
+    argscheck.checkArgs('nnFF', 'requestFileSystem', arguments);
     var fail = function(code) {
-        if (typeof errorCallback === 'function') {
-            errorCallback(new FileError(code));
-        }
+        errorCallback && errorCallback(new FileError(code));
     };
 
     if (type < 0 || type > 3) {
@@ -43,7 +43,7 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) {
         // if successful, return a FileSystem object
         var success = function(file_system) {
             if (file_system) {
-                if (typeof successCallback === 'function') {
+                if (successCallback) {
                     // grab the name and root from the file system object
                     var result = new FileSystem(file_system.name, file_system.root);
                     successCallback(result);