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

Unified Diff: background.js

Issue 8616119: Use require() properly instead of importing all symbols of a module (Closed)
Patch Set: Created Oct. 22, 2012, 8:48 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 | « no previous file | options.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
===================================================================
--- a/background.js
+++ b/background.js
@@ -1,25 +1,31 @@
-importAll("filterClasses", this);
-importAll("subscriptionClasses", this);
-importAll("filterStorage", this);
-importAll("elemHide", this);
-importAll("filterListener", this);
-importAll("filterNotifier", this);
-importAll("matcher", this);
-importAll("prefs", this);
-importAll("synchronizer", this);
-importAll("utils", this);
+with(require("filterClasses"))
+{
+ this.Filter = Filter;
+ this.RegExpFilter = RegExpFilter;
+ this.BlockingFilter = BlockingFilter;
+ this.WhitelistFilter = WhitelistFilter;
+}
+with(require("subscriptionClasses"))
+{
+ this.Subscription = Subscription;
+ this.DownloadableSubscription = DownloadableSubscription;
+}
+var FilterStorage = require("filterStorage").FilterStorage;
+var ElemHide = require("elemHide").ElemHide;
+var defaultMatcher = require("matcher").defaultMatcher;
+var Synchronizer = require("synchronizer").Synchronizer;
// Some types cannot be distinguished
RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT;
RegExpFilter.typeMap.MEDIA = RegExpFilter.typeMap.FONT = RegExpFilter.typeMap.OTHER;
var isFirstRun = false;
-FilterNotifier.addListener(function(action)
+require("filterNotifier").FilterNotifier.addListener(function(action)
{
if (action == "load")
{
importOldData();
if (!localStorage["currentVersion"])
{
isFirstRun = true;
executeFirstRunActions();
« no previous file with comments | « no previous file | options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld