| LEFT | RIGHT |
| 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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 sendResponse, | 49 sendResponse, |
| 50 reason => | 50 reason => |
| 51 { | 51 { |
| 52 console.error(reason); | 52 console.error(reason); |
| 53 sendResponse(undefined); | 53 sendResponse(undefined); |
| 54 } | 54 } |
| 55 ); | 55 ); |
| 56 async = true; | 56 async = true; |
| 57 } | 57 } |
| 58 else if (typeof response != "undefined") | 58 else if (typeof response != "undefined") |
| 59 { |
| 59 sendResponse(response); | 60 sendResponse(response); |
| 61 } |
| 60 } | 62 } |
| 61 | 63 |
| 62 return async; | 64 return async; |
| 63 }, | 65 }, |
| 64 | 66 |
| 65 /** | 67 /** |
| 66 * Function to be called when a particular message is received. | 68 * Function to be called when a particular message is received. |
| 67 * | 69 * |
| 68 * @callback Port~messageCallback | 70 * @callback Port~messageCallback |
| 69 * @param {object} message | 71 * @param {object} message |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 exports.getPort = function(window) | 123 exports.getPort = function(window) |
| 122 { | 124 { |
| 123 let port = new Port(); | 125 let port = new Port(); |
| 124 window.addEventListener("unload", () => | 126 window.addEventListener("unload", () => |
| 125 { | 127 { |
| 126 port.disconnect(); | 128 port.disconnect(); |
| 127 }); | 129 }); |
| 128 return port; | 130 return port; |
| 129 }; | 131 }; |
| 130 | 132 |
| LEFT | RIGHT |