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

Side by Side Diff: lib/io.js

Issue 29715577: Issue 6449 - Switch to Harmony modules (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Add lib/.eslintrc.json Created March 6, 2018, 10:30 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 "use strict";
19
20 const keyPrefix = "file:"; 18 const keyPrefix = "file:";
21 19
22 function fileToKey(fileName) 20 function fileToKey(fileName)
23 { 21 {
24 return keyPrefix + fileName; 22 return keyPrefix + fileName;
25 } 23 }
26 24
27 function loadFile(fileName) 25 function loadFile(fileName)
28 { 26 {
29 return new Promise((resolve, reject) => 27 return new Promise((resolve, reject) =>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 ext.storage.remove(fileToKey(fileName), () => 62 ext.storage.remove(fileToKey(fileName), () =>
65 { 63 {
66 if (browser.runtime.lastError) 64 if (browser.runtime.lastError)
67 reject(browser.runtime.lastError.message); 65 reject(browser.runtime.lastError.message);
68 else 66 else
69 resolve(); 67 resolve();
70 }); 68 });
71 }); 69 });
72 } 70 }
73 71
74 exports.IO = 72 export const IO = {
75 {
76 /** 73 /**
77 * Reads text lines from a file. 74 * Reads text lines from a file.
78 * @param {string} fileName 75 * @param {string} fileName
79 * Name of the file to be read 76 * Name of the file to be read
80 * @param {TextSink} listener 77 * @param {TextSink} listener
81 * Function that will be called for each line in the file 78 * Function that will be called for each line in the file
82 * @return {Promise} 79 * @return {Promise}
83 * Promise to be resolved or rejected once the operation is completed 80 * Promise to be resolved or rejected once the operation is completed
84 */ 81 */
85 readFromFile(fileName, listener) 82 readFromFile(fileName, listener)
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 lastModified: entry.lastModified 172 lastModified: entry.lastModified
176 }; 173 };
177 }).catch(error => 174 }).catch(error =>
178 { 175 {
179 if (error.type == "NoSuchFile") 176 if (error.type == "NoSuchFile")
180 return {exists: false}; 177 return {exists: false};
181 throw error; 178 throw error;
182 }); 179 });
183 } 180 }
184 }; 181 };
OLDNEW
« lib/.eslintrc.json ('K') | « lib/icon.js ('k') | lib/messaging.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld