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

Unified Diff: lib/messaging.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.
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/messaging.js
===================================================================
--- a/lib/messaging.js
+++ b/lib/messaging.js
@@ -12,19 +12,17 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
/** @module messaging */
-"use strict";
-
-const {EventEmitter} = require("events");
+import {EventEmitter} from "events";
/**
* Communication port wrapping ext.onMessage to receive messages.
*
* @constructor
*/
function Port()
{
@@ -107,26 +105,26 @@
}
};
/**
* The default port to receive messages.
*
* @type {Port}
*/
-exports.port = new Port();
+export const port = new Port();
/**
* Creates a new port that is disconnected when the given window is unloaded.
*
* @param {Window} window
* @return {Port}
*/
-exports.getPort = function(window)
+export function getPort(window)
{
- let port = new Port();
+ let newPort = new Port();
window.addEventListener("unload", () =>
{
- port.disconnect();
+ newPort.disconnect();
});
- return port;
-};
+ return newPort;
+}
« lib/.eslintrc.json ('K') | « lib/io.js ('k') | lib/notificationHelper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld