Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl

Issue 2759563004: Mojo JS bindings: change module loading solution. (Closed)
Patch Set: add test module-loading.html Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 {%- if use_new_js_bindings %}
6
7 (function() {
8 // TODO(yzshen): Define these aliases to minimize the differences between the
9 // old/new modes. Remove them when the old mode goes away.
10 var bindings = mojoBindings;
Ken Rockot(use gerrit already) 2017/03/20 15:27:20 optional nit: can we use let instead of var for ne
yzshen1 2017/03/20 17:45:02 Added "use strict". IOS9 doesn't support "let" y
11 var codec = mojoBindings.internal;
12 var validator = mojoBindings.internal;
13 {%- for import in imports %}
14 var {{import.unique_name}} = {{import.module.namespace}};
15 {%- endfor %}
16
17 {% include "module_definition.tmpl" %}
18 })();
19
20 {%- else %}
21
5 define("{{module.path}}", [ 22 define("{{module.path}}", [
6 {%- if module.path != "mojo/public/interfaces/bindings/interface_control_message s.mojom" %} 23 {%- if module.path != "mojo/public/interfaces/bindings/interface_control_messa ges.mojom" %}
7 "mojo/public/js/bindings", 24 "mojo/public/js/bindings",
8 {%- endif %} 25 {%- endif %}
9 "mojo/public/js/codec", 26 "mojo/public/js/codec",
10 "mojo/public/js/core", 27 "mojo/public/js/core",
11 "mojo/public/js/validator", 28 "mojo/public/js/validator",
12 {%- for import in imports %} 29 {%- for import in imports %}
13 "{{import.module.path}}", 30 "{{import.module.path}}",
14 {%- endfor %} 31 {%- endfor %}
15 ], function( 32 ], function(
16 {%- if module.path != "mojo/public/interfaces/bindings/interface_control_message s.mojom" -%} 33 {%- if module.path != "mojo/public/interfaces/bindings/interface_control_message s.mojom" -%}
17 bindings, {% endif -%} 34 bindings, {% endif -%}
18 codec, core, validator 35 codec, core, validator
19 {%- for import in imports -%} 36 {%- for import in imports -%}
20 , {{import.unique_name}} 37 , {{import.unique_name}}
21 {%- endfor -%} 38 {%- endfor -%}
22 ) { 39 ) {
23 40
24 {%- include "module_definition.tmpl" %} 41 {%- include "module_definition.tmpl" %}
25 42
26 return exports; 43 return exports;
27 }); 44 });
45
46 {%- endif %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698