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: Created Jan. 13, 2017, 12:11 p.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
Index: lib/io.js
diff --git a/lib/io.js b/lib/io.js
index 6a07389c6f2eafec04176b87cf46de1cacbd17c6..d7f12d00e55fb04ef4c50d4b6f639cd20cf5d2ae 100644
--- a/lib/io.js
+++ b/lib/io.js
@@ -26,7 +26,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 +51,9 @@ function saveFile(file, data, callback)
exports.IO =
{
- resolveFilePath: function(path)
- {
- return new FakeFile(path);
- },
+ resolveFilePath: path => new FakeFile(path),
- readFromFile: function(file, listener, callback)
+ readFromFile: (file, listener, callback) =>
{
function onLoaded(entry)
{
@@ -70,12 +67,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 +82,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 +95,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)
{
« chrome/ext/common.js ('K') | « lib/icon.js ('k') | lib/notificationHelper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld