| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 Loading... |
| 30 { | 30 { |
| 31 if (this._listeners.indexOf(listener) == -1) | 31 if (this._listeners.indexOf(listener) == -1) |
| 32 this._listeners.push(listener); | 32 this._listeners.push(listener); |
| 33 }, | 33 }, |
| 34 removeListener: function(listener) | 34 removeListener: function(listener) |
| 35 { | 35 { |
| 36 var idx = this._listeners.indexOf(listener); | 36 var idx = this._listeners.indexOf(listener); |
| 37 if (idx != -1) | 37 if (idx != -1) |
| 38 this._listeners.splice(idx, 1); | 38 this._listeners.splice(idx, 1); |
| 39 }, | 39 }, |
| 40 _dispatch: function(cancelable, args) | 40 _dispatch: function() |
| 41 { | 41 { |
| 42 var result = null; |
| 43 |
| 42 for (var i = 0; i < this._listeners.length; i++) | 44 for (var i = 0; i < this._listeners.length; i++) |
| 43 { | 45 { |
| 44 var result = this._listeners[i].apply(null, arguments); | 46 result = this._listeners[i].apply(null, arguments); |
| 47 |
| 45 if (this._cancelable && result === false) | 48 if (this._cancelable && result === false) |
| 46 return false; | 49 break; |
| 47 } | 50 } |
| 48 return true; | 51 |
| 52 return result; |
| 49 } | 53 } |
| 50 }; | 54 }; |
| 51 })(); | 55 })(); |
| OLD | NEW |