OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 define([ | 5 define([ |
6 "mojo/apps/js/bindings/core", | 6 "mojo/apps/js/bindings/core", |
7 "mojo/apps/js/bindings/codec", | 7 "mojo/apps/js/bindings/codec", |
8 {%- for import in imports %} | 8 {%- for import in imports %} |
9 "mojom/{{include_prefix}}{{import.module_name|camel_to_underscores}}", | 9 "mojom/{{include_prefix}}{{import.module_name|camel_to_underscores}}", |
10 {%- endfor %} | 10 {%- endfor %} |
11 ], function(core, codec | 11 ], function(core, codec |
12 {%- for import in imports -%} | 12 {%- for import in imports -%} |
13 , {{import.unique_name}} | 13 , {{import.unique_name}} |
14 {%- endfor -%} | 14 {%- endfor -%} |
15 ) { | 15 ) { |
16 | 16 |
17 {#--- Enums #} | 17 {#--- Enums #} |
18 {%- from "enum_definition.tmpl" import enum_def -%} | 18 {% from "enum_definition.tmpl" import enum_def -%} |
19 {% for enum in enums %} | 19 {% for enum in enums %} |
20 {{ enum_def("var %s"|format(enum.name), enum) }} | 20 var {{ enum_def(enum.name, enum, module) }} |
21 {%- endfor %} | 21 {%- endfor %} |
22 | 22 |
23 {#--- Struct definitions #} | 23 {#--- Struct definitions #} |
24 {% for struct in structs %} | 24 {% for struct in structs %} |
25 {% include "struct_definition.tmpl" %} | 25 {%- include "struct_definition.tmpl" %} |
26 {%- endfor %} | 26 {%- endfor %} |
27 | 27 |
28 {#--- Interface definitions #} | 28 {#--- Interface definitions #} |
29 {%- for interface in interfaces %} | 29 {%- for interface in interfaces %} |
30 {%- include "interface_definition.tmpl" %} | 30 {%- include "interface_definition.tmpl" %} |
31 {%- endfor %} | 31 {%- endfor %} |
32 | 32 |
33 var exports = {}; | 33 var exports = {}; |
34 {%- for enum in enums %} | 34 {%- for enum in enums %} |
35 exports.{{enum.name}} = {{enum.name}}; | 35 exports.{{enum.name}} = {{enum.name}}; |
36 {%- endfor %} | 36 {%- endfor %} |
37 {%- for struct in structs if struct.exported %} | 37 {%- for struct in structs if struct.exported %} |
38 exports.{{struct.name}} = {{struct.name}}; | 38 exports.{{struct.name}} = {{struct.name}}; |
39 {%- endfor %} | 39 {%- endfor %} |
40 {%- for interface in interfaces %} | 40 {%- for interface in interfaces %} |
41 exports.{{interface.name}}Proxy = {{interface.name}}Proxy; | 41 exports.{{interface.name}}Proxy = {{interface.name}}Proxy; |
42 exports.{{interface.name}}Stub = {{interface.name}}Stub; | 42 exports.{{interface.name}}Stub = {{interface.name}}Stub; |
43 {%- endfor %} | 43 {%- endfor %} |
44 return exports; | 44 return exports; |
45 }); | 45 }); |
OLD | NEW |