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 2013/01/10 15:34:02 UTC
js commit: [all] Minor simplifications to FileEntry.js
Updated Branches:
refs/heads/master cc5327d58 -> dc99f7631
[all] Minor simplifications to FileEntry.js
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/dc99f763
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/dc99f763
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/dc99f763
Branch: refs/heads/master
Commit: dc99f76310125cd470077589a74d8fcf4689b528
Parents: cc5327d
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Jan 8 20:17:22 2013 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Jan 10 09:33:59 2013 -0500
----------------------------------------------------------------------
lib/common/plugin/FileEntry.js | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/dc99f763/lib/common/plugin/FileEntry.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/FileEntry.js b/lib/common/plugin/FileEntry.js
index ff1d9a9..cc9c740 100644
--- a/lib/common/plugin/FileEntry.js
+++ b/lib/common/plugin/FileEntry.js
@@ -52,13 +52,9 @@ FileEntry.prototype.createWriter = function(successCallback, errorCallback) {
var writer = new FileWriter(filePointer);
if (writer.fileName === null || writer.fileName === "") {
- if (typeof errorCallback === "function") {
- errorCallback(new FileError(FileError.INVALID_STATE_ERR));
- }
+ errorCallback && errorCallback(new FileError(FileError.INVALID_STATE_ERR));
} else {
- if (typeof successCallback === "function") {
- successCallback(writer);
- }
+ successCallback && successCallback(writer);
}
}, errorCallback);
};
@@ -70,11 +66,11 @@ FileEntry.prototype.createWriter = function(successCallback, errorCallback) {
* @param {Function} errorCallback is called with a FileError
*/
FileEntry.prototype.file = function(successCallback, errorCallback) {
- var win = typeof successCallback !== 'function' ? null : function(f) {
+ var win = successCallback && function(f) {
var file = new File(f.name, f.fullPath, f.type, f.lastModifiedDate, f.size);
successCallback(file);
};
- var fail = typeof errorCallback !== 'function' ? null : function(code) {
+ var fail = errorCallback && function(code) {
errorCallback(new FileError(code));
};
exec(win, fail, "File", "getFileMetadata", [this.fullPath]);