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

Unified Diff: lib/stats.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: Use const as per the new rules Created Jan. 18, 2017, 7: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
« no previous file with comments | « lib/requestBlocker.js ('k') | lib/subscriptionInit.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/stats.js
diff --git a/lib/stats.js b/lib/stats.js
index 81dfff3af0728c3ef5941002c01f055752cdccc3..8f6cd32fd1131e4afe7faa6f8bead3156489bdc7 100644
--- a/lib/stats.js
+++ b/lib/stats.js
@@ -17,11 +17,13 @@
/** @module stats */
-let {Prefs} = require("prefs");
-let {BlockingFilter} = require("filterClasses");
-let {FilterNotifier} = require("filterNotifier");
+"use strict";
-let badgeColor = "#646464";
+const {Prefs} = require("prefs");
+const {BlockingFilter} = require("filterClasses");
+const {FilterNotifier} = require("filterNotifier");
+
+const badgeColor = "#646464";
let blockedPerPage = new ext.PageMap();
/**
@@ -30,10 +32,7 @@ let blockedPerPage = new ext.PageMap();
* @param {Page} page
* @return {Number}
*/
-exports.getBlockedPerPage = function(page)
-{
- return blockedPerPage.get(page) || 0;
-};
+exports.getBlockedPerPage = page => blockedPerPage.get(page) || 0;
FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, page) =>
{
@@ -57,11 +56,10 @@ FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, page) =>
Prefs.on("show_statsinicon", () =>
{
- ext.pages.query({}, function(pages)
+ ext.pages.query({}, pages =>
{
- for (var i = 0; i < pages.length; i++)
+ for (let page of pages)
{
- let page = pages[i];
let badge = null;
if (Prefs.show_statsinicon)
« no previous file with comments | « lib/requestBlocker.js ('k') | lib/subscriptionInit.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld