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

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: . 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 "use strict";
8
9 (function() {
10 // TODO(yzshen): Define these aliases to minimize the differences between the
11 // old/new modes. Remove them when the old mode goes away.
12 var bindings = mojoBindings;
13 var codec = mojoBindings.internal;
14 var validator = mojoBindings.internal;
15 {%- for import in imports %}
16 var {{import.unique_name}} = {{import.module.namespace}};
17 {%- endfor %}
18
19 {% include "module_definition.tmpl" %}
20 })();
21
22 {%- else %}
23
5 define("{{module.path}}", [ 24 define("{{module.path}}", [
6 {%- if module.path != "mojo/public/interfaces/bindings/interface_control_message s.mojom" %} 25 {%- if module.path != "mojo/public/interfaces/bindings/interface_control_messa ges.mojom" %}
7 "mojo/public/js/bindings", 26 "mojo/public/js/bindings",
8 {%- endif %} 27 {%- endif %}
9 "mojo/public/js/codec", 28 "mojo/public/js/codec",
10 "mojo/public/js/core", 29 "mojo/public/js/core",
11 "mojo/public/js/validator", 30 "mojo/public/js/validator",
12 {%- for import in imports %} 31 {%- for import in imports %}
13 "{{import.module.path}}", 32 "{{import.module.path}}",
14 {%- endfor %} 33 {%- endfor %}
15 ], function( 34 ], function(
16 {%- if module.path != "mojo/public/interfaces/bindings/interface_control_message s.mojom" -%} 35 {%- if module.path != "mojo/public/interfaces/bindings/interface_control_message s.mojom" -%}
17 bindings, {% endif -%} 36 bindings, {% endif -%}
18 codec, core, validator 37 codec, core, validator
19 {%- for import in imports -%} 38 {%- for import in imports -%}
20 , {{import.unique_name}} 39 , {{import.unique_name}}
21 {%- endfor -%} 40 {%- endfor -%}
22 ) { 41 ) {
23 42
24 {%- include "module_definition.tmpl" %} 43 {%- include "module_definition.tmpl" %}
25 44
26 return exports; 45 return exports;
27 }); 46 });
47
48 {%- endif %}
OLDNEW
« no previous file with comments | « mojo/public/js/new_bindings/validator.js ('k') | mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698