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

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

Issue 643323002: [Mojo] Add support for HTML imports as well as AMD modules (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indent Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 define("{{module.path}}", [
6 "mojo/public/js/bindings/codec",
7 "mojo/public/js/bindings/validator",
8 {%- for import in imports %}
9 "{{import.module.path}}",
10 {%- endfor %}
11 ], function(codec, validator
12 {%- for import in imports -%}
13 , {{import.unique_name}}
14 {%- endfor -%}
15 ) {
16
17 {#--- Constants #} 1 {#--- Constants #}
18 {% for constant in module.constants %} 2 {%- for constant in module.constants %}
19 var {{constant.name}} = {{constant.value|expression_to_text}}; 3 var {{constant.name}} = {{constant.value|expression_to_text}};
20 {%- endfor %} 4 {%- endfor %}
21 5
22 {#--- Enums #} 6 {#--- Enums #}
23 {%- from "enum_definition.tmpl" import enum_def %} 7 {%- from "enum_definition.tmpl" import enum_def %}
24 {%- for enum in enums %} 8 {%- for enum in enums %}
25 var {{ enum_def(enum.name, enum) }} 9 var {{ enum_def(enum.name, enum) }}
26 {%- endfor %} 10 {%- endfor %}
27 11
28 {#--- Struct definitions #} 12 {#--- Struct definitions #}
(...skipping 18 matching lines...) Expand all
47 {%- endfor %} 31 {%- endfor %}
48 {%- for interface in interfaces %} 32 {%- for interface in interfaces %}
49 exports.{{interface.name}} = {{interface.name}}; 33 exports.{{interface.name}} = {{interface.name}};
50 {#--- Interface Client #} 34 {#--- Interface Client #}
51 {%- if interface.client in interfaces|map(attribute='name') %} 35 {%- if interface.client in interfaces|map(attribute='name') %}
52 exports.{{interface.name}}.client = {{interface.client}}; 36 exports.{{interface.name}}.client = {{interface.client}};
53 {%- elif interface.client in imported_interfaces %} 37 {%- elif interface.client in imported_interfaces %}
54 exports.{{interface.name}}.client = {{imported_interfaces[interface.client]}}; 38 exports.{{interface.name}}.client = {{imported_interfaces[interface.client]}};
55 {%- endif %} 39 {%- endif %}
56 {%- endfor %} 40 {%- endfor %}
57
58 return exports;
59 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698