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

Unified Diff: lib/filterNotifier.js

Issue 29375915: Issue 4878 - Start using ESLint for adblockpluscore (Closed)
Patch Set: Remove the arrow-parens rule Created March 9, 2017, 10:23 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/filterNotifier.js
diff --git a/lib/filterNotifier.js b/lib/filterNotifier.js
index 624b2bf48d3c0fa5e8008a5690800b471fa846ab..b66bf56625f0d5664e7c8344cf28e76c3578fc59 100644
--- a/lib/filterNotifier.js
+++ b/lib/filterNotifier.js
@@ -15,17 +15,26 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
+"use strict";
+
/**
* @fileOverview This component manages listeners and calls them to distributes
* messages about filter changes.
*/
-let {EventEmitter} = require("events");
-let {desc} = require("coreUtils");
+const {EventEmitter} = require("events");
+const {desc} = require("coreUtils");
const CATCH_ALL = "__all";
/**
+ * @callback FilterNotifierCatchAllListener
+ * @param {string} action
+ * @param {Subscription|Filter} item
+ * @param{...*} additionalInfo
Wladimir Palant 2017/03/09 14:37:13 Nit: space before { for consistency?
kzar 2017/03/10 06:56:13 Done.
+ */
+
+/**
* This class allows registering and triggering listeners for filter events.
* @class
*/
@@ -34,8 +43,9 @@ exports.FilterNotifier = Object.create(new EventEmitter(), desc({
* Adds a listener
*
* @deprecated use FilterNotifier.on(action, callback)
+ * @param {FilterNotifierCatchAllListener} listener
*/
- addListener: function(/**function(action, item, newValue, oldValue)*/ listener)
+ addListener(listener)
{
let listeners = this._listeners[CATCH_ALL];
if (!listeners || listeners.indexOf(listener) == -1)
@@ -46,15 +56,16 @@ exports.FilterNotifier = Object.create(new EventEmitter(), desc({
* Removes a listener that was previosly added via addListener
*
* @deprecated use FilterNotifier.off(action, callback)
+ * @param {FilterNotifierCatchAllListener} listener
*/
- removeListener: function(/**function(action, item, newValue, oldValue)*/ listener)
+ removeListener(listener)
{
this.off(CATCH_ALL, listener);
},
/**
* Notifies listeners about an event
- * @param {String} action event code ("load", "save", "elemhideupdate",
+ * @param {string} action event code ("load", "save", "elemhideupdate",
* "subscription.added", "subscription.removed",
* "subscription.disabled", "subscription.title",
* "subscription.lastDownload", "subscription.downloadStatus",
@@ -62,9 +73,12 @@ exports.FilterNotifier = Object.create(new EventEmitter(), desc({
* "filter.added", "filter.removed", "filter.moved",
* "filter.disabled", "filter.hitCount", "filter.lastHit")
* @param {Subscription|Filter} item item that the change applies to
+ * @param {*} param1
+ * @param {*} param2
+ * @param {*} param3
* @deprecated use FilterNotifier.emit(action)
*/
- triggerListeners: function(action, item, param1, param2, param3)
+ triggerListeners(action, item, param1, param2, param3)
{
this.emit(action, item, param1, param2, param3);
this.emit(CATCH_ALL, action, item, param1, param2, param3);
« no previous file with comments | « lib/filterListener.js ('k') | lib/filterStorage.js » ('j') | lib/notification.js » ('J')

Powered by Google App Engine
This is Rietveld