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

Unified Diff: lib/compat.js

Issue 29363560: Issue 4552 - Drop jshydra dependency (adblockpluschrome) (Closed)
Patch Set: Remove require parameter Created Nov. 30, 2016, 2: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 | « dependencies ('k') | lib/io.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compat.js
diff --git a/lib/compat.js b/lib/compat.js
index 9a78e434dfd2c46071d5b920501034d1d9054e80..d544edca8faa300d5ff3833b0470131b43d7b4a6 100644
--- a/lib/compat.js
+++ b/lib/compat.js
@@ -21,15 +21,14 @@
function require(module)
{
- var result = require.scopes[module];
- if (typeof result == "function" && !(module in require.loaded))
+ if (!(module in require.scopes))
{
- result = require.scopes[module] = result();
- require.loaded[module] = true;
+ let scope = {exports: {}};
+ require.scopes[module] = require.modules[module](scope, scope.exports);
}
- return result;
+ return require.scopes[module];
}
-require.loaded = Object.create(null);
+require.modules = Object.create(null);
require.scopes = Object.create(null);
function importAll(module, globalObj)
@@ -79,6 +78,9 @@ var Components =
},
results: {},
utils: {
+ import: function()
+ {
+ },
reportError: function(e)
{
console.error(e);
« no previous file with comments | « dependencies ('k') | lib/io.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld