| Index: lib/icon.js |
| =================================================================== |
| --- a/lib/icon.js |
| +++ b/lib/icon.js |
| @@ -12,19 +12,17 @@ |
| * 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/>. |
| */ |
| /** @module icon */ |
| -"use strict"; |
| - |
| -const {FilterNotifier} = require("filterNotifier"); |
| +import {FilterNotifier} from "filterNotifier"; |
| const frameOpacities = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, |
| 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, |
| 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0.0]; |
| const numberOfFrames = frameOpacities.length; |
| let stopRequested = false; |
| let canUpdateIcon = true; |
| @@ -178,42 +176,41 @@ |
| clearInterval(interval); |
| ext.pages.onActivated.removeListener(onActivated); |
| canUpdateIcon = true; |
| } |
| }, 100); |
| }); |
| } |
| -let stopIconAnimation = |
| /** |
| * Stops to animate the browser action icon |
| * after the current interval has been finished. |
| * |
| * @return {Promise} A promise that is fullfilled when |
| * the icon animation has been stopped. |
| */ |
| -exports.stopIconAnimation = () => |
| +export const stopIconAnimation = () => |
| { |
| stopRequested = true; |
| return notRunning.then(() => |
| { |
| stopRequested = false; |
| }); |
| }; |
| /** |
| * Starts to animate the browser action icon to indicate a pending notifcation. |
| * If the icon is already animated, it replaces the previous |
| * animation as soon as the current interval has been finished. |
| * |
| * @param {string} type The notification type (i.e: "information" or |
| * "critical".) |
| */ |
| -exports.startIconAnimation = type => |
| +export const startIconAnimation = type => |
| { |
| notRunning = new Promise(resolve => |
| { |
| Promise.all([renderFrames(type), stopIconAnimation()]).then(results => |
| { |
| if (stopRequested) |
| { |
| resolve(); |