| 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; |
| +} |