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

Unified Diff: lib/filterNotifier.js

Issue 29335650: Issue 2595 - Use the core code from adblockpluscore (Closed)
Patch Set: Created Feb. 4, 2016, 6:35 p.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
« no previous file with comments | « lib/filterListener.js ('k') | lib/filterStorage.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterNotifier.js
===================================================================
deleted file mode 100644
--- a/lib/filterNotifier.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of Adblock Plus <https://adblockplus.org/>,
- * Copyright (C) 2006-2016 Eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * @fileOverview This component manages listeners and calls them to distributes
- * messages about filter changes.
- */
-
-/**
- * List of registered listeners
- * @type function[]
- */
-let listeners = [];
-
-/**
- * This class allows registering and triggering listeners for filter events.
- * @class
- */
-let FilterNotifier = exports.FilterNotifier =
-{
- /**
- * Adds a listener
- */
- addListener: function(/**function(action, item, newValue, oldValue)*/ listener)
- {
- if (listeners.indexOf(listener) >= 0)
- return;
-
- listeners.push(listener);
- },
-
- /**
- * Removes a listener that was previosly added via addListener
- */
- removeListener: function(/**function(action, item, newValue, oldValue)*/ listener)
- {
- let index = listeners.indexOf(listener);
- if (index >= 0)
- listeners.splice(index, 1);
- },
-
- /**
- * Notifies listeners about an event
- * @param {String} action event code ("load", "save", "elemhideupdate",
- * "subscription.added", "subscription.removed",
- * "subscription.disabled", "subscription.title",
- * "subscription.lastDownload", "subscription.downloadStatus",
- * "subscription.homepage", "subscription.updated",
- * "filter.added", "filter.removed", "filter.moved",
- * "filter.disabled", "filter.hitCount", "filter.lastHit")
- * @param {Subscription|Filter} item item that the change applies to
- */
- triggerListeners: function(action, item, param1, param2, param3)
- {
- let list = listeners.slice();
- for (let listener of list)
- listener(action, item, param1, param2, param3);
- }
-};
« no previous file with comments | « lib/filterListener.js ('k') | lib/filterStorage.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld