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

Delta Between Two Patch Sets: lib/messaging.js

Issue 29338534: Issue 3826 - Filter preference change events (Closed)
Left Patch Set: Rebased and updated adblockplusui dependency Created March 22, 2016, 3:42 p.m.
Right Patch Set: Fixed some issues Created March 23, 2016, 11:32 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« lib/events.js ('K') | « lib/events.js ('k') | lib/prefs.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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
(...skipping 19 matching lines...) Expand all
30 { 30 {
31 this._eventEmitter = new EventEmitter(); 31 this._eventEmitter = new EventEmitter();
32 this._onMessage = this._onMessage.bind(this); 32 this._onMessage = this._onMessage.bind(this);
33 ext.onMessage.addListener(this._onMessage); 33 ext.onMessage.addListener(this._onMessage);
34 }; 34 };
35 35
36 Port.prototype = { 36 Port.prototype = {
37 _onMessage: function(message, sender, sendResponse) 37 _onMessage: function(message, sender, sendResponse)
38 { 38 {
39 let async = false; 39 let async = false;
40 let callbacks = this._eventEmitter._callbacks[message.type]; 40 let callbacks = this._eventEmitter._listeners[message.type];
41 41
42 if (callbacks) 42 if (callbacks)
43 { 43 {
44 for (let callback of callbacks) 44 for (let callback of callbacks)
45 { 45 {
46 let response = callback(message, sender); 46 let response = callback(message, sender);
47 47
48 if (response && typeof response.then == "function") 48 if (response && typeof response.then == "function")
49 { 49 {
50 response.then( 50 response.then(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 exports.getPort = function(window) 125 exports.getPort = function(window)
126 { 126 {
127 let port = new Port(); 127 let port = new Port();
128 window.addEventListener("unload", () => 128 window.addEventListener("unload", () =>
129 { 129 {
130 port.disconnect(); 130 port.disconnect();
131 }); 131 });
132 return port; 132 return port;
133 }; 133 };
134 134
LEFTRIGHT

Powered by Google App Engine
This is Rietveld