Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 Loading... | |
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 -%} |
LEFT | RIGHT |