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

Delta Between Two Patch Sets: templates/modules.js.tmpl

Issue 29399569: Issue 5060 - Move require into modules template, make info a module (Closed)
Left Patch Set: Addressed more feedback Created March 31, 2017, 3:15 p.m.
Right Patch Set: Improve check for require Created April 1, 2017, 1:27 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « templates/geckoInfo.js.tmpl ('k') | tests/test_packagerEdge.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 {%- if args["module"] -%} 1 {%- if args["module"] -%}
2 if (typeof require == "undefined") 2 if (typeof require != "function")
kzar 2017/04/01 01:32:57 As discussed in IRC this is safer, since if a webp
Sebastian Noack 2017/04/01 10:02:56 Wow, I never noticed that named elements become au
3 { 3 {
4 var require = function(module) 4 var require = function(module)
5 { 5 {
6 if (!(module in require.scopes)) 6 if (!(module in require.scopes))
7 { 7 {
8 let scope = {exports: {}}; 8 let scope = {exports: {}};
9 require.scopes[module] = require.modules[module](scope, scope.exports); 9 require.scopes[module] = require.modules[module](scope, scope.exports);
10 } 10 }
11 return require.scopes[module]; 11 return require.scopes[module];
12 }; 12 };
(...skipping 25 matching lines...) Expand all
38 {%- for module_name in args["autoload"] -%} 38 {%- for module_name in args["autoload"] -%}
39 {%- if module_name in modules -%} 39 {%- if module_name in modules -%}
40 require({{ module_name|json }}); 40 require({{ module_name|json }});
41 {% endif %} 41 {% endif %}
42 {%- endfor -%} 42 {%- endfor -%}
43 {%- else -%} 43 {%- else -%}
44 {%- for module_name, script in modules -%} 44 {%- for module_name, script in modules -%}
45 {{ script }} 45 {{ script }}
46 {% endfor -%} 46 {% endfor -%}
47 {%- endif -%} 47 {%- endif -%}
LEFTRIGHT

Powered by Google App Engine
This is Rietveld