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

Side by Side Diff: ext/common.js

Issue 5464830253203456: Refactored the abstraction layer to address prerendered pages on Safari caused by leaky abstraction (Closed)
Patch Set: Addressed comments Created April 11, 2014, 2:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ext/background.js ('k') | iconAnimation.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17
18
19 (function()
20 {
21 window.ext = {};
22
23 var EventTarget = ext._EventTarget = function(cancelable)
24 {
25 this._listeners = [];
26 this._cancelable = cancelable;
27 };
28 EventTarget.prototype = {
29 addListener: function(listener)
30 {
31 if (this._listeners.indexOf(listener) == -1)
32 this._listeners.push(listener);
33 },
34 removeListener: function(listener)
35 {
36 var idx = this._listeners.indexOf(listener);
37 if (idx != -1)
38 this._listeners.splice(idx, 1);
39 },
40 _dispatch: function(cancelable, args)
41 {
42 for (var i = 0; i < this._listeners.length; i++)
43 {
44 var result = this._listeners[i].apply(null, arguments);
45 if (this._cancelable && result === false)
46 return false;
47 }
48 return true;
49 }
50 };
51 })();
OLDNEW
« no previous file with comments | « ext/background.js ('k') | iconAnimation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld