Repository: cordova-plugin-file Updated Branches: refs/heads/master b514aaf40 -> 07557e02a
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/blackberry10/readEntries.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/readEntries.js b/www/blackberry10/readEntries.js index 6dcb6da..667ea3c 100644 --- a/www/blackberry10/readEntries.js +++ b/www/blackberry10/readEntries.js @@ -19,9 +19,9 @@ * */ -/* +/* * readEntries - * + * * IN: * args * 0 - URL of directory to list @@ -30,40 +30,42 @@ * fail - FileError */ -var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'), - requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'), - createEntryFromNative = cordova.require('cordova-plugin-file.bb10CreateEntryFromNative'); +/* eslint-disable no-undef */ +var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'); +var requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'); +var createEntryFromNative = cordova.require('cordova-plugin-file.bb10CreateEntryFromNative'); +/* eslint-enable no-undef */ module.exports = function (success, fail, args) { - var uri = args[0], - onSuccess = function (data) { - if (typeof success === 'function') { - success(data); - } - }, - onFail = function (error) { - if (typeof fail === 'function') { - if (error.code) { - fail(error.code); - } else { - fail(error); - } + var uri = args[0]; + var onSuccess = function (data) { + if (typeof success === 'function') { + success(data); + } + }; + var onFail = function (error) { + if (typeof fail === 'function') { + if (error.code) { + fail(error.code); + } else { + fail(error); } - }; + } + }; resolve(function (fs) { requestAnimationFrame(function () { - var reader = fs.nativeEntry.createReader(), - entries = [], - readEntries = function() { - reader.readEntries(function (results) { - if (!results.length) { - onSuccess(entries.sort().map(createEntryFromNative)); - } else { - entries = entries.concat(Array.prototype.slice.call(results || [], 0)); - readEntries(); - } - }, onFail); - }; + var reader = fs.nativeEntry.createReader(); + var entries = []; + var readEntries = function () { + reader.readEntries(function (results) { + if (!results.length) { + onSuccess(entries.sort().map(createEntryFromNative)); + } else { + entries = entries.concat(Array.prototype.slice.call(results || [], 0)); + readEntries(); + } + }, onFail); + }; readEntries(); }); }, fail, [uri]); http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/blackberry10/remove.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/remove.js b/www/blackberry10/remove.js index 7932da6..bfbe102 100644 --- a/www/blackberry10/remove.js +++ b/www/blackberry10/remove.js @@ -19,9 +19,9 @@ * */ -/* +/* * remove - * + * * IN: * args * 0 - URL of Entry to remove @@ -30,29 +30,31 @@ * fail - FileError */ -var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'), - requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'); +/* eslint-disable no-undef */ +var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'); +var requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'); +/* eslint-enable no-undef */ module.exports = function (success, fail, args) { - var uri = args[0], - onSuccess = function (data) { - if (typeof success === 'function') { - success(data); - } - }, - onFail = function (error) { - if (typeof fail === 'function') { - if (error && error.code) { - fail(error.code); - } else { - fail(error); - } + var uri = args[0]; + var onSuccess = function (data) { + if (typeof success === 'function') { + success(data); + } + }; + var onFail = function (error) { + if (typeof fail === 'function') { + if (error && error.code) { + fail(error.code); + } else { + fail(error); } - }; + } + }; resolve(function (fs) { requestAnimationFrame(function () { if (fs.fullPath === '/') { - onFail(FileError.NO_MODIFICATION_ALLOWED_ERR); + onFail(FileError.NO_MODIFICATION_ALLOWED_ERR); // eslint-disable-line no-undef } else { fs.nativeEntry.remove(onSuccess, onFail); } http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/blackberry10/removeRecursively.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/removeRecursively.js b/www/blackberry10/removeRecursively.js index fe01a67..29d8a73 100644 --- a/www/blackberry10/removeRecursively.js +++ b/www/blackberry10/removeRecursively.js @@ -19,9 +19,9 @@ * */ -/* +/* * removeRecursively - * + * * IN: * args * 0 - URL of DirectoryEntry to remove recursively @@ -30,33 +30,35 @@ * fail - FileError */ -var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'), - requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'); +/* eslint-disable no-undef */ +var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'); +var requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'); +/* eslint-enable no-undef */ module.exports = function (success, fail, args) { - var uri = args[0], - onSuccess = function (data) { - if (typeof success === 'function') { - success(data); - } - }, - onFail = function (error) { - if (typeof fail === 'function') { - if (error.code) { - if (error.code === FileError.INVALID_MODIFICATION_ERR) { - //mobile-spec expects this error code - fail(FileError.NO_MODIFICATION_ALLOWED_ERR); - } else { - fail(error.code); - } + var uri = args[0]; + var onSuccess = function (data) { + if (typeof success === 'function') { + success(data); + } + }; + var onFail = function (error) { + if (typeof fail === 'function') { + if (error.code) { + if (error.code === FileError.INVALID_MODIFICATION_ERR) { // eslint-disable-line no-undef + // mobile-spec expects this error code + fail(FileError.NO_MODIFICATION_ALLOWED_ERR); // eslint-disable-line no-undef } else { - fail(error); + fail(error.code); } + } else { + fail(error); } - }; + } + }; resolve(function (fs) { requestAnimationFrame(function () { fs.nativeEntry.removeRecursively(onSuccess, onFail); - }); + }); }, fail, [uri]); }; http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/blackberry10/requestAllFileSystems.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/requestAllFileSystems.js b/www/blackberry10/requestAllFileSystems.js index d023beb..1cbae40 100644 --- a/www/blackberry10/requestAllFileSystems.js +++ b/www/blackberry10/requestAllFileSystems.js @@ -19,9 +19,9 @@ * */ -/* +/* * requestAllFileSystems - * + * * IN - no arguments * OUT * success - Array of FileSystems http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/blackberry10/requestAnimationFrame.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/requestAnimationFrame.js b/www/blackberry10/requestAnimationFrame.js index aac0a4a..b4274d5 100644 --- a/www/blackberry10/requestAnimationFrame.js +++ b/www/blackberry10/requestAnimationFrame.js @@ -21,18 +21,18 @@ /* * requestAnimationFrame - * + * * This is used throughout the BB10 File implementation to wrap * native webkit calls. There is a bug in the webkit implementation * which causes callbacks to never return when multiple file system * APIs are called in sequence. This should also make the UI more * responsive during file operations. - * + * * Supported on BB10 OS > 10.1 */ var requestAnimationFrame = window.requestAnimationFrame; -if (typeof(requestAnimationFrame) !== 'function') { +if (typeof (requestAnimationFrame) !== 'function') { requestAnimationFrame = function (cb) { cb(); }; } module.exports = requestAnimationFrame; http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/blackberry10/requestFileSystem.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/requestFileSystem.js b/www/blackberry10/requestFileSystem.js index 489e510..616c93d 100644 --- a/www/blackberry10/requestFileSystem.js +++ b/www/blackberry10/requestFileSystem.js @@ -19,11 +19,11 @@ * */ -/* +/* * requestFileSystem * * IN: - * args + * args * 0 - type (TEMPORARY = 0, PERSISTENT = 1) * 1 - size * OUT: @@ -37,17 +37,17 @@ * fail - FileError code */ -var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'); +var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'); // eslint-disable-line no-undef module.exports = function (success, fail, args) { - var fsType = args[0] === 0 ? 'temporary' : 'persistent', - size = args[1], - onSuccess = function (fs) { - var directory = { - name: fsType, - root: fs - }; - success(directory); + var fsType = args[0] === 0 ? 'temporary' : 'persistent'; + var size = args[1]; + var onSuccess = function (fs) { + var directory = { + name: fsType, + root: fs }; + success(directory); + }; resolve(onSuccess, fail, ['cdvfile://localhost/' + fsType + '/', undefined, size]); }; http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/blackberry10/resolveLocalFileSystemURI.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/resolveLocalFileSystemURI.js b/www/blackberry10/resolveLocalFileSystemURI.js index 5e82b5b..ba8795a 100644 --- a/www/blackberry10/resolveLocalFileSystemURI.js +++ b/www/blackberry10/resolveLocalFileSystemURI.js @@ -38,30 +38,30 @@ * fail - FileError code */ -var info = require('cordova-plugin-file.bb10FileSystemInfo'), - requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'), - createEntryFromNative = require('cordova-plugin-file.bb10CreateEntryFromNative'), - SANDBOXED = true, - UNSANDBOXED = false; +var info = require('cordova-plugin-file.bb10FileSystemInfo'); +var requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'); // eslint-disable-line no-undef +var createEntryFromNative = require('cordova-plugin-file.bb10CreateEntryFromNative'); +var SANDBOXED = true; +var UNSANDBOXED = false; module.exports = function (success, fail, args) { - var request = args[0], - options = args[1], - size = args[2]; + var request = args[0]; + var options = args[1]; + var size = args[2]; if (request) { request = decodeURIComponent(request); if (request.indexOf('?') > -1) { - //bb10 does not support params; strip them off + // bb10 does not support params; strip them off request = request.substring(0, request.indexOf('?')); } if (request.indexOf('file://localhost/') === 0) { - //remove localhost prefix + // remove localhost prefix request = request.replace('file://localhost/', 'file:///'); } - //requests to sandboxed locations should use cdvfile + // requests to sandboxed locations should use cdvfile request = request.replace(info.persistentPath, 'cdvfile://localhost/persistent'); request = request.replace(info.temporaryPath, 'cdvfile://localhost/temporary'); - //pick appropriate handler + // pick appropriate handler if (request.indexOf('file:///') === 0) { resolveFile(success, fail, request, options); } else if (request.indexOf('cdvfile://localhost/') === 0) { @@ -69,57 +69,54 @@ module.exports = function (success, fail, args) { } else if (request.indexOf('local:///') === 0) { resolveLocal(success, fail, request, options); } else { - fail(FileError.ENCODING_ERR); + fail(FileError.ENCODING_ERR); // eslint-disable-line no-undef } } else { - fail(FileError.NOT_FOUND_ERR); + fail(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef } }; -//resolve file:/// -function resolveFile(success, fail, request, options) { +// resolve file:/// +function resolveFile (success, fail, request, options) { var path = request.substring(7); resolve(success, fail, path, window.PERSISTENT, UNSANDBOXED, options); } -//resolve cdvfile://localhost/filesystemname/ -function resolveCdvFile(success, fail, request, options, size) { - var components = /cdvfile:\/\/localhost\/([^\/]+)\/(.*)/.exec(request), - fsType = components[1], - path = components[2]; +// resolve cdvfile://localhost/filesystemname/ +function resolveCdvFile (success, fail, request, options, size) { + var components = /cdvfile:\/\/localhost\/([^\/]+)\/(.*)/.exec(request); // eslint-disable-line no-useless-escape + var fsType = components[1]; + var path = components[2]; if (fsType === 'persistent') { resolve(success, fail, path, window.PERSISTENT, SANDBOXED, options, size); - } - else if (fsType === 'temporary') { + } else if (fsType === 'temporary') { resolve(success, fail, path, window.TEMPORARY, SANDBOXED, options, size); - } - else if (fsType === 'root') { + } else if (fsType === 'root') { resolve(success, fail, path, window.PERSISTENT, UNSANDBOXED, options); - } - else { - fail(FileError.NOT_FOUND_ERR); + } else { + fail(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef } } -//resolve local:/// -function resolveLocal(success, fail, request, options) { - var path = localPath + request.substring(8); +// resolve local:/// +function resolveLocal (success, fail, request, options) { + var path = localPath + request.substring(8); // eslint-disable-line no-undef resolve(success, fail, path, window.PERSISTENT, UNSANDBOXED, options); } -//validate parameters and set sandbox -function resolve(success, fail, path, fsType, sandbox, options, size) { +// validate parameters and set sandbox +function resolve (success, fail, path, fsType, sandbox, options, size) { options = options || { create: false }; size = size || info.MAX_SIZE; if (size > info.MAX_SIZE) { - //bb10 does not respect quota; fail at unreasonably large size - fail(FileError.QUOTA_EXCEEDED_ERR); + // bb10 does not respect quota; fail at unreasonably large size + fail(FileError.QUOTA_EXCEEDED_ERR); // eslint-disable-line no-undef } else if (path.indexOf(':') > -1) { - //files with : character are not valid in Cordova apps - fail(FileError.ENCODING_ERR); + // files with : character are not valid in Cordova apps + fail(FileError.ENCODING_ERR); // eslint-disable-line no-undef } else { requestAnimationFrame(function () { - cordova.exec(function () { + cordova.exec(function () { // eslint-disable-line no-undef requestAnimationFrame(function () { resolveNative(success, fail, path, fsType, options, size); }); @@ -128,17 +125,17 @@ function resolve(success, fail, path, fsType, sandbox, options, size) { } } -//find path using webkit file system -function resolveNative(success, fail, path, fsType, options, size) { +// find path using webkit file system +function resolveNative (success, fail, path, fsType, options, size) { window.webkitRequestFileSystem( fsType, size, function (fs) { if (path === '') { - //no path provided, call success with root file system + // no path provided, call success with root file system success(createEntryFromNative(fs.root)); } else { - //otherwise attempt to resolve as file + // otherwise attempt to resolve as file fs.root.getFile( path, options, @@ -146,7 +143,7 @@ function resolveNative(success, fail, path, fsType, options, size) { success(createEntryFromNative(entry)); }, function (fileError) { - //file not found, attempt to resolve as directory + // file not found, attempt to resolve as directory fs.root.getDirectory( path, options, @@ -154,13 +151,13 @@ function resolveNative(success, fail, path, fsType, options, size) { success(createEntryFromNative(entry)); }, function (dirError) { - //path cannot be resolved - if (fileError.code === FileError.INVALID_MODIFICATION_ERR && + // path cannot be resolved + if (fileError.code === FileError.INVALID_MODIFICATION_ERR && // eslint-disable-line no-undef options.exclusive) { - //mobile-spec expects this error code - fail(FileError.PATH_EXISTS_ERR); + // mobile-spec expects this error code + fail(FileError.PATH_EXISTS_ERR); // eslint-disable-line no-undef } else { - fail(FileError.NOT_FOUND_ERR); + fail(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef } } ); http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/blackberry10/setMetadata.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/setMetadata.js b/www/blackberry10/setMetadata.js index 0f2dc79..bff5312 100644 --- a/www/blackberry10/setMetadata.js +++ b/www/blackberry10/setMetadata.js @@ -19,15 +19,15 @@ * */ -/* +/* * setMetadata - * - * BB10 OS does not support setting file metadata via HTML5 File System + * + * BB10 OS does not support setting file metadata via HTML5 File System */ module.exports = function (success, fail, args) { - console.error("setMetadata not supported on BB10", arguments); - if (typeof(fail) === 'function') { + console.error('setMetadata not supported on BB10', arguments); + if (typeof (fail) === 'function') { fail(); } }; http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/blackberry10/truncate.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/truncate.js b/www/blackberry10/truncate.js index fe43b7e..3d785b4 100644 --- a/www/blackberry10/truncate.js +++ b/www/blackberry10/truncate.js @@ -19,9 +19,9 @@ * */ -/* +/* * truncate - * + * * IN: * args * 0 - URL of file to truncate @@ -31,33 +31,37 @@ * fail - FileError */ -var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'), - requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'); +/* eslint-disable no-undef */ +var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'); +var requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'); +/* eslint-enable no-undef */ module.exports = function (success, fail, args) { - var uri = args[0], - length = args[1], - onSuccess = function (data) { - if (typeof success === 'function') { - success(data.loaded); - } - }, - onFail = function (error) { - if (typeof fail === 'function') { - if (error && error.code) { - fail(error.code); - } else { - fail(error); - } + var uri = args[0]; + var length = args[1]; + var onSuccess = function (data) { + if (typeof success === 'function') { + success(data.loaded); + } + }; + var onFail = function (error) { + if (typeof fail === 'function') { + if (error && error.code) { + fail(error.code); + } else { + fail(error); } - }; + } + }; resolve(function (fs) { requestAnimationFrame(function () { fs.nativeEntry.file(function (file) { + /* eslint-disable no-undef */ var reader = new FileReader()._realReader; reader.onloadend = function () { - var contents = new Uint8Array(this.result).subarray(0, length), - blob = new Blob([contents]); + var contents = new Uint8Array(this.result).subarray(0, length); + var blob = new Blob([contents]); + /* eslint-enable no-undef */ window.requestAnimationFrame(function () { fs.nativeEntry.createWriter(function (fileWriter) { fileWriter.onwriteend = onSuccess; http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/blackberry10/write.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/write.js b/www/blackberry10/write.js index b2ed261..62bd41b 100644 --- a/www/blackberry10/write.js +++ b/www/blackberry10/write.js @@ -19,9 +19,9 @@ * */ -/* +/* * write - * + * * IN: * args * 0 - URL of file to write @@ -32,35 +32,36 @@ * success - bytes written * fail - FileError */ - -var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'), - requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'); +/* eslint-disable no-undef */ +var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'); +var requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'); +/* eslint-enable no-undef */ module.exports = function (success, fail, args) { - var uri = args[0], - data = args[1], - offset = args[2], - //isBinary = args[3], - onSuccess = function (data) { - if (typeof success === 'function') { - success(data.loaded); - } - }, - onFail = function (error) { - if (typeof fail === 'function') { - if (error && error.code) { - fail(error.code); - } else if (error && error.target && error.target.code) { - fail(error.target.code); - } else { - fail(error); - } + var uri = args[0]; + var data = args[1]; + var offset = args[2]; + // isBinary = args[3], + var onSuccess = function (data) { + if (typeof success === 'function') { + success(data.loaded); + } + }; + var onFail = function (error) { + if (typeof fail === 'function') { + if (error && error.code) { + fail(error.code); + } else if (error && error.target && error.target.code) { + fail(error.target.code); + } else { + fail(error); } - }; + } + }; resolve(function (fs) { requestAnimationFrame(function () { fs.nativeEntry.createWriter(function (writer) { - var blob = new Blob([data]); + var blob = new Blob([data]); // eslint-disable-line no-undef if (offset) { writer.seek(offset); } http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/browser/FileSystem.js ---------------------------------------------------------------------- diff --git a/www/browser/FileSystem.js b/www/browser/FileSystem.js index c0996cb..a7c1d6c 100644 --- a/www/browser/FileSystem.js +++ b/www/browser/FileSystem.js @@ -19,13 +19,12 @@ * */ -/*global FILESYSTEM_PREFIX: true, module*/ +/* global FILESYSTEM_PREFIX: true, module */ -FILESYSTEM_PREFIX = "file:///"; +FILESYSTEM_PREFIX = 'file:///'; module.exports = { - __format__: function(fullPath) { - return (FILESYSTEM_PREFIX + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)); + __format__: function (fullPath) { + return (FILESYSTEM_PREFIX + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)); // eslint-disable-line no-undef } }; - http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/browser/Preparing.js ---------------------------------------------------------------------- diff --git a/www/browser/Preparing.js b/www/browser/Preparing.js index 7845f9e..b826a65 100644 --- a/www/browser/Preparing.js +++ b/www/browser/Preparing.js @@ -20,9 +20,9 @@ */ (function () { - /*global require*/ + /* global require */ - //Only Chrome uses this file. + // Only Chrome uses this file. if (!require('./isChrome')()) { return; } @@ -30,26 +30,26 @@ var channel = require('cordova/channel'); var FileError = require('./FileError'); var PERSISTENT_FS_QUOTA = 5 * 1024 * 1024; - var filePluginIsReadyEvent = new Event('filePluginIsReady'); + var filePluginIsReadyEvent = new Event('filePluginIsReady'); // eslint-disable-line no-undef var entryFunctionsCreated = false; var quotaWasRequested = false; var eventWasThrown = false; if (!window.requestFileSystem) { - window.requestFileSystem = function(type, size, win, fail) { + window.requestFileSystem = function (type, size, win, fail) { if (fail) { - fail("Not supported"); + fail('Not supported'); } }; } else { - window.requestFileSystem(window.TEMPORARY, 1, createFileEntryFunctions, function() {}); + window.requestFileSystem(window.TEMPORARY, 1, createFileEntryFunctions, function () {}); } if (!window.resolveLocalFileSystemURL) { - window.resolveLocalFileSystemURL = function(url, win, fail) { - if(fail) { - fail("Not supported"); + window.resolveLocalFileSystemURL = function (url, win, fail) { + if (fail) { + fail('Not supported'); } }; } @@ -58,14 +58,14 @@ // Cordova-specific (cdvfile://) universal way. // Aligns with specification: http://www.w3.org/TR/2011/WD-file-system-api-20110419/#widl-LocalFileSystem-resolveLocalFileSystemURL var nativeResolveLocalFileSystemURL = window.resolveLocalFileSystemURL || window.webkitResolveLocalFileSystemURL; - window.resolveLocalFileSystemURL = function(url, win, fail) { + window.resolveLocalFileSystemURL = function (url, win, fail) { /* If url starts with `cdvfile` then we need convert it to Chrome real url first: cdvfile://localhost/persistent/path/to/file -> filesystem:file://persistent/path/to/file */ - if (url.trim().substr(0,7) === "cdvfile") { + if (url.trim().substr(0, 7) === 'cdvfile') { /* Quirk: Plugin supports cdvfile://localhost (local resources) only. I.e. external resources are not supported via cdvfile. */ - if (url.indexOf("cdvfile://localhost") !== -1) { + if (url.indexOf('cdvfile://localhost') !== -1) { // Browser supports temporary and persistent only var indexPersistent = url.indexOf('persistent'); var indexTemporary = url.indexOf('temporary'); @@ -75,15 +75,15 @@ For example, filesystem:file:///persistent/somefile.txt, filesystem:http://localhost:8080/persistent/somefile.txt. */ var prefix = 'filesystem:file:///'; - if (location.protocol !== 'file:') { - prefix = 'filesystem:' + location.origin + '/'; + if (location.protocol !== 'file:') { // eslint-disable-line no-undef + prefix = 'filesystem:' + location.origin + '/'; // eslint-disable-line no-undef } var result; if (indexPersistent !== -1) { // cdvfile://localhost/persistent/path/to/file -> filesystem:file://persistent/path/to/file // or filesystem:http://localhost:8080/persistent/path/to/file - result = prefix + 'persistent' + url.substr(indexPersistent + 10); + result = prefix + 'persistent' + url.substr(indexPersistent + 10); nativeResolveLocalFileSystemURL(result, win, fail); return; } @@ -106,8 +106,8 @@ } }; - function createFileEntryFunctions(fs) { - fs.root.getFile('todelete_658674_833_4_cdv', {create: true}, function(fileEntry) { + function createFileEntryFunctions (fs) { + fs.root.getFile('todelete_658674_833_4_cdv', {create: true}, function (fileEntry) { var fileEntryType = Object.getPrototypeOf(fileEntry); var entryType = Object.getPrototypeOf(fileEntryType); @@ -126,59 +126,59 @@ return this.toURL(); }; - entryType.toInternalURL = function() { - if (this.toURL().indexOf("persistent") > -1) { - return "cdvfile://localhost/persistent" + this.fullPath; + entryType.toInternalURL = function () { + if (this.toURL().indexOf('persistent') > -1) { + return 'cdvfile://localhost/persistent' + this.fullPath; } - if (this.toURL().indexOf("temporary") > -1) { - return "cdvfile://localhost/temporary" + this.fullPath; + if (this.toURL().indexOf('temporary') > -1) { + return 'cdvfile://localhost/temporary' + this.fullPath; } }; - entryType.setMetadata = function(win, fail /*, metadata*/) { + entryType.setMetadata = function (win, fail /*, metadata */) { if (fail) { - fail("Not supported"); + fail('Not supported'); } }; - fileEntry.createWriter(function(writer) { + fileEntry.createWriter(function (writer) { var originalWrite = writer.write; var writerProto = Object.getPrototypeOf(writer); - writerProto.write = function(blob) { - if(blob instanceof Blob) { + writerProto.write = function (blob) { + if (blob instanceof Blob) { // eslint-disable-line no-undef originalWrite.apply(this, [blob]); } else { - var realBlob = new Blob([blob]); + var realBlob = new Blob([blob]); // eslint-disable-line no-undef originalWrite.apply(this, [realBlob]); - } + } }; - fileEntry.remove(function(){ entryFunctionsCreated = true; }, function(){ /* empty callback */ }); - }); + fileEntry.remove(function () { entryFunctionsCreated = true; }, function () { /* empty callback */ }); + }); }); } - window.initPersistentFileSystem = function(size, win, fail) { + window.initPersistentFileSystem = function (size, win, fail) { if (navigator.webkitPersistentStorage) { navigator.webkitPersistentStorage.requestQuota(size, win, fail); return; } - fail("This browser does not support this function"); + fail('This browser does not support this function'); }; window.isFilePluginReadyRaised = function () { return eventWasThrown; }; - window.initPersistentFileSystem(PERSISTENT_FS_QUOTA, function() { + window.initPersistentFileSystem(PERSISTENT_FS_QUOTA, function () { console.log('Persistent fs quota granted'); quotaWasRequested = true; - }, function(e){ + }, function (e) { console.log('Error occured while trying to request Persistent fs quota: ' + JSON.stringify(e)); }); channel.onCordovaReady.subscribe(function () { - function dispatchEventIfReady() { + function dispatchEventIfReady () { if (entryFunctionsCreated && quotaWasRequested) { window.dispatchEvent(filePluginIsReadyEvent); eventWasThrown = true; http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/fileSystemPaths.js ---------------------------------------------------------------------- diff --git a/www/fileSystemPaths.js b/www/fileSystemPaths.js index 640b9d6..f79794b 100644 --- a/www/fileSystemPaths.js +++ b/www/fileSystemPaths.js @@ -51,8 +51,8 @@ exports.file = { }; channel.waitForInitialization('onFileSystemPathsReady'); -channel.onCordovaReady.subscribe(function() { - function after(paths) { +channel.onCordovaReady.subscribe(function () { + function after (paths) { for (var k in paths) { exports.file[k] = paths[k]; } @@ -60,4 +60,3 @@ channel.onCordovaReady.subscribe(function() { } exec(after, null, 'File', 'requestAllPaths', []); }); - http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/fileSystems-roots.js ---------------------------------------------------------------------- diff --git a/www/fileSystems-roots.js b/www/fileSystems-roots.js index 107a9b8..9a3fc7a 100644 --- a/www/fileSystems-roots.js +++ b/www/fileSystems-roots.js @@ -25,8 +25,8 @@ var FileSystem = require('./FileSystem'); var exec = require('cordova/exec'); // Overridden by Android, BlackBerry 10 and iOS to populate fsMap. -require('./fileSystems').getFs = function(name, callback) { - function success(response) { +require('./fileSystems').getFs = function (name, callback) { + function success (response) { fsMap = {}; for (var i = 0; i < response.length; ++i) { var fsRoot = response[i]; @@ -39,7 +39,6 @@ require('./fileSystems').getFs = function(name, callback) { if (fsMap) { callback(fsMap[name]); } else { - exec(success, null, "File", "requestAllFileSystems", []); + exec(success, null, 'File', 'requestAllFileSystems', []); } }; - http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/fileSystems.js ---------------------------------------------------------------------- diff --git a/www/fileSystems.js b/www/fileSystems.js index 8ecdec3..40e5574 100644 --- a/www/fileSystems.js +++ b/www/fileSystems.js @@ -20,6 +20,6 @@ */ // Overridden by Android, BlackBerry 10 and iOS to populate fsMap. -module.exports.getFs = function(name, callback) { +module.exports.getFs = function (name, callback) { callback(null); }; http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/firefoxos/FileSystem.js ---------------------------------------------------------------------- diff --git a/www/firefoxos/FileSystem.js b/www/firefoxos/FileSystem.js index edc003b..4a84eb1 100644 --- a/www/firefoxos/FileSystem.js +++ b/www/firefoxos/FileSystem.js @@ -18,12 +18,11 @@ * under the License. * */ - -FILESYSTEM_PREFIX = "file:///"; +/* eslint no-undef : 0 */ +FILESYSTEM_PREFIX = 'file:///'; module.exports = { - __format__: function(fullPath) { + __format__: function (fullPath) { return (FILESYSTEM_PREFIX + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)); } }; - http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/ios/FileSystem.js ---------------------------------------------------------------------- diff --git a/www/ios/FileSystem.js b/www/ios/FileSystem.js index 114ebb0..cb14c78 100644 --- a/www/ios/FileSystem.js +++ b/www/ios/FileSystem.js @@ -18,13 +18,12 @@ * under the License. * */ - -FILESYSTEM_PROTOCOL = "cdvfile"; +/* eslint no-undef : 0 */ +FILESYSTEM_PROTOCOL = 'cdvfile'; module.exports = { - __format__: function(fullPath) { - var path = ('/'+this.name+(fullPath[0]==='/'?'':'/')+FileSystem.encodeURIPath(fullPath)).replace('//','/'); + __format__: function (fullPath) { + var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); return FILESYSTEM_PROTOCOL + '://localhost' + path; } }; - http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/osx/FileSystem.js ---------------------------------------------------------------------- diff --git a/www/osx/FileSystem.js b/www/osx/FileSystem.js index 114ebb0..cb14c78 100644 --- a/www/osx/FileSystem.js +++ b/www/osx/FileSystem.js @@ -18,13 +18,12 @@ * under the License. * */ - -FILESYSTEM_PROTOCOL = "cdvfile"; +/* eslint no-undef : 0 */ +FILESYSTEM_PROTOCOL = 'cdvfile'; module.exports = { - __format__: function(fullPath) { - var path = ('/'+this.name+(fullPath[0]==='/'?'':'/')+FileSystem.encodeURIPath(fullPath)).replace('//','/'); + __format__: function (fullPath) { + var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); return FILESYSTEM_PROTOCOL + '://localhost' + path; } }; - http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/requestFileSystem.js ---------------------------------------------------------------------- diff --git a/www/requestFileSystem.js b/www/requestFileSystem.js index 300937e..d9110cd 100644 --- a/www/requestFileSystem.js +++ b/www/requestFileSystem.js @@ -19,10 +19,10 @@ * */ -(function() { - //For browser platform: not all browsers use this file. - function checkBrowser() { - if (cordova.platformId === "browser" && require('./isChrome')()) { +(function () { + // For browser platform: not all browsers use this file. + function checkBrowser () { + if (cordova.platformId === 'browser' && require('./isChrome')()) { // eslint-disable-line no-undef module.exports = window.requestFileSystem || window.webkitRequestFileSystem; return true; } @@ -32,10 +32,10 @@ return; } - var argscheck = require('cordova/argscheck'), - FileError = require('./FileError'), - FileSystem = require('./FileSystem'), - exec = require('cordova/exec'); + var argscheck = require('cordova/argscheck'); + var FileError = require('./FileError'); + var FileSystem = require('./FileSystem'); + var exec = require('cordova/exec'); var fileSystems = require('./fileSystems'); /** @@ -45,9 +45,9 @@ * @param successCallback invoked with a FileSystem object * @param errorCallback invoked if error occurs retrieving file system */ - var requestFileSystem = function(type, size, successCallback, errorCallback) { + var requestFileSystem = function (type, size, successCallback, errorCallback) { argscheck.checkArgs('nnFF', 'requestFileSystem', arguments); - var fail = function(code) { + var fail = function (code) { if (errorCallback) { errorCallback(new FileError(code)); } @@ -57,10 +57,10 @@ fail(FileError.SYNTAX_ERR); } else { // if successful, return a FileSystem object - var success = function(file_system) { + var success = function (file_system) { if (file_system) { if (successCallback) { - fileSystems.getFs(file_system.name, function(fs) { + fileSystems.getFs(file_system.name, function (fs) { // This should happen only on platforms that haven't implemented requestAllFileSystems (windows) if (!fs) { fs = new FileSystem(file_system.name, file_system.root); @@ -68,13 +68,12 @@ successCallback(fs); }); } - } - else { + } else { // no FileSystem object returned fail(FileError.NOT_FOUND_ERR); } }; - exec(success, fail, "File", "requestFileSystem", [type, size]); + exec(success, fail, 'File', 'requestFileSystem', [type, size]); } }; http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/resolveLocalFileSystemURI.js ---------------------------------------------------------------------- diff --git a/www/resolveLocalFileSystemURI.js b/www/resolveLocalFileSystemURI.js index bfa3b07..764662c 100644 --- a/www/resolveLocalFileSystemURI.js +++ b/www/resolveLocalFileSystemURI.js @@ -18,10 +18,10 @@ * under the License. * */ -(function() { - //For browser platform: not all browsers use overrided `resolveLocalFileSystemURL`. - function checkBrowser() { - if (cordova.platformId === "browser" && require('./isChrome')()) { +(function () { + // For browser platform: not all browsers use overrided `resolveLocalFileSystemURL`. + function checkBrowser () { + if (cordova.platformId === 'browser' && require('./isChrome')()) { // eslint-disable-line no-undef module.exports.resolveLocalFileSystemURL = window.resolveLocalFileSystemURL || window.webkitResolveLocalFileSystemURL; return true; } @@ -31,11 +31,11 @@ return; } - var argscheck = require('cordova/argscheck'), - DirectoryEntry = require('./DirectoryEntry'), - FileEntry = require('./FileEntry'), - FileError = require('./FileError'), - exec = require('cordova/exec'); + var argscheck = require('cordova/argscheck'); + var DirectoryEntry = require('./DirectoryEntry'); + var FileEntry = require('./FileEntry'); + var FileError = require('./FileError'); + var exec = require('cordova/exec'); var fileSystems = require('./fileSystems'); /** @@ -44,49 +44,48 @@ * @param successCallback invoked with Entry object corresponding to URI * @param errorCallback invoked if error occurs retrieving file system entry */ - module.exports.resolveLocalFileSystemURL = module.exports.resolveLocalFileSystemURL || function(uri, successCallback, errorCallback) { + module.exports.resolveLocalFileSystemURL = module.exports.resolveLocalFileSystemURL || function (uri, successCallback, errorCallback) { argscheck.checkArgs('sFF', 'resolveLocalFileSystemURI', arguments); // error callback - var fail = function(error) { + var fail = function (error) { if (errorCallback) { errorCallback(new FileError(error)); } }; // sanity check for 'not:valid:filename' or '/not:valid:filename' // file.spec.12 window.resolveLocalFileSystemURI should error (ENCODING_ERR) when resolving invalid URI with leading /. - if(!uri || uri.split(":").length > 2) { - setTimeout( function() { + if (!uri || uri.split(':').length > 2) { + setTimeout(function () { fail(FileError.ENCODING_ERR); - },0); + }, 0); return; } // if successful, return either a file or directory entry - var success = function(entry) { + var success = function (entry) { if (entry) { if (successCallback) { // create appropriate Entry object - var fsName = entry.filesystemName || (entry.filesystem && entry.filesystem.name) || (entry.filesystem == window.PERSISTENT ? 'persistent' : 'temporary'); - fileSystems.getFs(fsName, function(fs) { + var fsName = entry.filesystemName || (entry.filesystem && entry.filesystem.name) || (entry.filesystem === window.PERSISTENT ? 'persistent' : 'temporary'); // eslint-disable-line no-undef + fileSystems.getFs(fsName, function (fs) { // This should happen only on platforms that haven't implemented requestAllFileSystems (windows) if (!fs) { - fs = new FileSystem(fsName, {name:"", fullPath:"/"}); + fs = new FileSystem(fsName, {name: '', fullPath: '/'}); // eslint-disable-line no-undef } var result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath, fs, entry.nativeURL) : new FileEntry(entry.name, entry.fullPath, fs, entry.nativeURL); successCallback(result); }); } - } - else { + } else { // no Entry object returned fail(FileError.NOT_FOUND_ERR); } }; - exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]); + exec(success, fail, 'File', 'resolveLocalFileSystemURI', [uri]); }; - module.exports.resolveLocalFileSystemURI = function() { - console.log("resolveLocalFileSystemURI is deprecated. Please call resolveLocalFileSystemURL instead."); + module.exports.resolveLocalFileSystemURI = function () { + console.log('resolveLocalFileSystemURI is deprecated. Please call resolveLocalFileSystemURL instead.'); module.exports.resolveLocalFileSystemURL.apply(this, arguments); }; })(); http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/ubuntu/FileSystem.js ---------------------------------------------------------------------- diff --git a/www/ubuntu/FileSystem.js b/www/ubuntu/FileSystem.js index 3594565..20a1d11 100644 --- a/www/ubuntu/FileSystem.js +++ b/www/ubuntu/FileSystem.js @@ -19,16 +19,15 @@ * */ -FILESYSTEM_PROTOCOL = "cdvfile"; +FILESYSTEM_PROTOCOL = 'cdvfile'; // eslint-disable-line no-undef module.exports = { - __format__: function(fullPath) { + __format__: function (fullPath) { if (this.name === 'content') { return 'content:/' + fullPath; } - var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//','/'); + var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/'); // eslint-disable-line no-undef - return FILESYSTEM_PROTOCOL + '://localhost' + path; + return FILESYSTEM_PROTOCOL + '://localhost' + path; // eslint-disable-line no-undef } }; - http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/ubuntu/FileWriter.js ---------------------------------------------------------------------- diff --git a/www/ubuntu/FileWriter.js b/www/ubuntu/FileWriter.js index 5428cb2..ef70c47 100644 --- a/www/ubuntu/FileWriter.js +++ b/www/ubuntu/FileWriter.js @@ -19,19 +19,20 @@ * */ -var exec = require('cordova/exec'), - FileError = require('./FileError'), - ProgressEvent = require('./ProgressEvent'); +var exec = require('cordova/exec'); +var FileError = require('./FileError'); +var ProgressEvent = require('./ProgressEvent'); -function write(data) { - var that=this; +function write (data) { + var that = this; var supportsBinary = (typeof window.Blob !== 'undefined' && typeof window.ArrayBuffer !== 'undefined'); var isBinary; // Check to see if the incoming data is a blob + /* eslint-disable no-undef */ if (data instanceof File || (supportsBinary && data instanceof Blob)) { var fileReader = new FileReader(); - fileReader.onload = function() { + fileReader.onload = function () { // Call this method again, with the arraybuffer as argument FileWriter.prototype.write.call(that, this.result); }; @@ -53,34 +54,34 @@ function write(data) { // WRITING state this.readyState = FileWriter.WRITING; - + /* eslint-enable no-undef */ var me = this; // If onwritestart callback - if (typeof me.onwritestart === "function") { - me.onwritestart(new ProgressEvent("writestart", {"target":me})); + if (typeof me.onwritestart === 'function') { + me.onwritestart(new ProgressEvent('writestart', {'target': me})); } if (data instanceof ArrayBuffer || data.buffer instanceof ArrayBuffer) { data = new Uint8Array(data); - var binary = ""; - for (var i = 0; i < data.byteLength; i++) { + var binary = ''; + for (var i = 0; i < data.byteLength; i++) { binary += String.fromCharCode(data[i]); - } + } data = binary; } - var prefix = "file://localhost"; + var prefix = 'file://localhost'; var path = this.localURL; - if (path.substr(0, prefix.length) == prefix) { + if (path.substr(0, prefix.length) === prefix) { path = path.substr(prefix.length); } // Write file exec( // Success callback - function(r) { + function (r) { // If DONE (cancelled), then don't do anything - if (me.readyState === FileWriter.DONE) { + if (me.readyState === FileWriter.DONE) { // eslint-disable-line no-undef return; } @@ -91,45 +92,45 @@ function write(data) { me.length = me.position; // DONE state - me.readyState = FileWriter.DONE; + me.readyState = FileWriter.DONE; // eslint-disable-line no-undef // If onwrite callback - if (typeof me.onwrite === "function") { - me.onwrite(new ProgressEvent("write", {"target":me})); + if (typeof me.onwrite === 'function') { + me.onwrite(new ProgressEvent('write', {'target': me})); } // If onwriteend callback - if (typeof me.onwriteend === "function") { - me.onwriteend(new ProgressEvent("writeend", {"target":me})); + if (typeof me.onwriteend === 'function') { + me.onwriteend(new ProgressEvent('writeend', {'target': me})); } }, // Error callback - function(e) { + function (e) { // If DONE (cancelled), then don't do anything - if (me.readyState === FileWriter.DONE) { + if (me.readyState === FileWriter.DONE) { // eslint-disable-line no-undef return; } // DONE state - me.readyState = FileWriter.DONE; + me.readyState = FileWriter.DONE; // eslint-disable-line no-undef // Save error me.error = new FileError(e); // If onerror callback - if (typeof me.onerror === "function") { - me.onerror(new ProgressEvent("error", {"target":me})); + if (typeof me.onerror === 'function') { + me.onerror(new ProgressEvent('error', {'target': me})); } // If onwriteend callback - if (typeof me.onwriteend === "function") { - me.onwriteend(new ProgressEvent("writeend", {"target":me})); + if (typeof me.onwriteend === 'function') { + me.onwriteend(new ProgressEvent('writeend', {'target': me})); } - }, "File", "write", [path, data, this.position, isBinary]); + }, 'File', 'write', [path, data, this.position, isBinary]); } module.exports = { write: write }; -require("cordova/exec/proxy").add("FileWriter", module.exports); +require('cordova/exec/proxy').add('FileWriter', module.exports); http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/ubuntu/fileSystems-roots.js ---------------------------------------------------------------------- diff --git a/www/ubuntu/fileSystems-roots.js b/www/ubuntu/fileSystems-roots.js index d2c6857..4bd6d6d 100644 --- a/www/ubuntu/fileSystems-roots.js +++ b/www/ubuntu/fileSystems-roots.js @@ -24,8 +24,8 @@ var FileSystem = require('./FileSystem'); var LocalFileSystem = require('./LocalFileSystem'); var exec = require('cordova/exec'); -var requestFileSystem = function(type, size, successCallback) { - var success = function(file_system) { +var requestFileSystem = function (type, size, successCallback) { + var success = function (file_system) { if (file_system) { if (successCallback) { var fs = new FileSystem(file_system.name, file_system.root); @@ -33,15 +33,15 @@ var requestFileSystem = function(type, size, successCallback) { } } }; - exec(success, null, "File", "requestFileSystem", [type, size]); + exec(success, null, 'File', 'requestFileSystem', [type, size]); }; -require('./fileSystems').getFs = function(name, callback) { +require('./fileSystems').getFs = function (name, callback) { if (fsMap) { callback(fsMap[name]); } else { - requestFileSystem(LocalFileSystem.PERSISTENT, 1, function(fs) { - requestFileSystem(LocalFileSystem.TEMPORARY, 1, function(tmp) { + requestFileSystem(LocalFileSystem.PERSISTENT, 1, function (fs) { + requestFileSystem(LocalFileSystem.TEMPORARY, 1, function (tmp) { fsMap = {}; fsMap[tmp.name] = tmp; fsMap[fs.name] = fs; @@ -50,4 +50,3 @@ require('./fileSystems').getFs = function(name, callback) { }); } }; - http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/07557e02/www/wp/FileUploadOptions.js ---------------------------------------------------------------------- diff --git a/www/wp/FileUploadOptions.js b/www/wp/FileUploadOptions.js index 696573a..869e263 100644 --- a/www/wp/FileUploadOptions.js +++ b/www/wp/FileUploadOptions.js @@ -27,21 +27,20 @@ * @param mimeType {String} Mimetype of the uploaded file. Defaults to image/jpeg. * @param params {Object} Object with key: value params to send to the server. */ -var FileUploadOptions = function(fileKey, fileName, mimeType, params, headers, httpMethod) { +var FileUploadOptions = function (fileKey, fileName, mimeType, params, headers, httpMethod) { this.fileKey = fileKey || null; this.fileName = fileName || null; this.mimeType = mimeType || null; this.headers = headers || null; this.httpMethod = httpMethod || null; - if(params && typeof params != typeof "") { + if (params && typeof params !== typeof '') { var arrParams = []; - for(var v in params) { - arrParams.push(v + "=" + params[v]); + for (var v in params) { + arrParams.push(v + '=' + params[v]); } - this.params = encodeURIComponent(arrParams.join("&")); - } - else { + this.params = encodeURIComponent(arrParams.join('&')); + } else { this.params = params || null; } }; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
