Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/io.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: Workaround limiation with iterating element collections in older versions of Chrome Created Jan. 16, 2017, 8:46 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/icon.js ('k') | lib/messaging.js » ('j') | lib/notificationHelper.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/io.js
diff --git a/lib/io.js b/lib/io.js
index 6a07389c6f2eafec04176b87cf46de1cacbd17c6..4b352d0036d40e65157666ba728ddd84e2420101 100644
--- a/lib/io.js
+++ b/lib/io.js
@@ -15,6 +15,8 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
+"use strict";
+
const keyPrefix = "file:";
function fileToKey(file)
@@ -26,7 +28,7 @@ function loadFile(file, successCallback, errorCallback)
{
let key = fileToKey(file);
- ext.storage.get([key], function(items)
+ ext.storage.get([key], items =>
{
let entry = items[key];
@@ -51,12 +53,9 @@ function saveFile(file, data, callback)
exports.IO =
{
- resolveFilePath: function(path)
- {
- return new FakeFile(path);
- },
+ resolveFilePath(path) { return new FakeFile(path); },
- readFromFile: function(file, listener, callback)
+ readFromFile(file, listener, callback)
{
function onLoaded(entry)
{
@@ -70,12 +69,12 @@ exports.IO =
loadFile(file, onLoaded, callback);
},
- writeToFile: function(file, data, callback)
+ writeToFile(file, data, callback)
{
saveFile(file, data, callback);
},
- copyFile: function(fromFile, toFile, callback)
+ copyFile(fromFile, toFile, callback)
{
function onLoaded(entry)
{
@@ -85,11 +84,11 @@ exports.IO =
loadFile(fromFile, onLoaded, callback);
},
- renameFile: function(fromFile, newName, callback)
+ renameFile(fromFile, newName, callback)
{
function onLoaded(entry)
{
- ext.storage.remove(fileToKey(fromFile), function()
+ ext.storage.remove(fileToKey(fromFile), () =>
{
ext.storage.set(keyPrefix + newName, entry, callback);
});
@@ -98,12 +97,12 @@ exports.IO =
loadFile(fromFile, onLoaded, callback);
},
- removeFile: function(file, callback)
+ removeFile(file, callback)
{
ext.storage.remove(fileToKey(file), callback);
},
- statFile: function(file, callback)
+ statFile(file, callback)
{
function onLoaded(entry)
{
« no previous file with comments | « lib/icon.js ('k') | lib/messaging.js » ('j') | lib/notificationHelper.js » ('J')

Powered by Google App Engine
This is Rietveld