OLD | NEW |
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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 | 18 |
19 (function() | 19 (function() |
20 { | 20 { |
21 // Both Edge and Mozilla Web Extensions use the namespace 'browser' instead of
'chrome' | 21 // Both Edge and Mozilla Web Extensions use the namespace 'browser' instead of
'chrome' |
22 if (!("chrome" in window)) | 22 if (typeof browser != 'undefined') |
23 window.chrome = window.browser; | 23 window.chrome = window.browser; |
24 | 24 |
25 window.ext = {}; | 25 window.ext = {}; |
26 | 26 |
27 var EventTarget = ext._EventTarget = function() | 27 var EventTarget = ext._EventTarget = function() |
28 { | 28 { |
29 this._listeners = []; | 29 this._listeners = []; |
30 }; | 30 }; |
31 EventTarget.prototype = { | 31 EventTarget.prototype = { |
32 addListener: function(listener) | 32 addListener: function(listener) |
(...skipping 12 matching lines...) Expand all Loading... |
45 var results = []; | 45 var results = []; |
46 var listeners = this._listeners.slice(); | 46 var listeners = this._listeners.slice(); |
47 | 47 |
48 for (var i = 0; i < listeners.length; i++) | 48 for (var i = 0; i < listeners.length; i++) |
49 results.push(listeners[i].apply(null, arguments)); | 49 results.push(listeners[i].apply(null, arguments)); |
50 | 50 |
51 return results; | 51 return results; |
52 } | 52 } |
53 }; | 53 }; |
54 })(); | 54 })(); |
OLD | NEW |