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

Unified Diff: lib/messaging.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: Use const as per the new rules Created Jan. 18, 2017, 7:23 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/io.js ('k') | lib/notificationHelper.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/messaging.js
diff --git a/lib/messaging.js b/lib/messaging.js
index 8cb24de383f32a0a7995339e5863a533687b1e68..4e8f3237b546fb5bbb9de02b5f8c9ef9438b3d8d 100644
--- a/lib/messaging.js
+++ b/lib/messaging.js
@@ -19,7 +19,7 @@
"use strict";
-let {EventEmitter} = require("events");
+const {EventEmitter} = require("events");
/**
* Communication port wrapping ext.onMessage to receive messages.
@@ -34,7 +34,7 @@ function Port()
};
Port.prototype = {
- _onMessage: function(message, sender, sendResponse)
+ _onMessage(message, sender, sendResponse)
{
let async = false;
let callbacks = this._eventEmitter.listeners(message.type);
@@ -81,7 +81,7 @@ Port.prototype = {
* @param {string} name
* @param {Port~messageCallback} callback
*/
- on: function(name, callback)
+ on(name, callback)
{
this._eventEmitter.on(name, callback);
},
@@ -92,7 +92,7 @@ Port.prototype = {
* @param {string} name
* @param {Port~messageCallback} callback
*/
- off: function(name, callback)
+ off(name, callback)
{
this._eventEmitter.off(name, callback);
},
@@ -100,7 +100,7 @@ Port.prototype = {
/**
* Disables the port and makes it stop listening to incoming messages.
*/
- disconnect: function()
+ disconnect()
{
ext.onMessage.removeListener(this._onMessage);
}
« no previous file with comments | « lib/io.js ('k') | lib/notificationHelper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld