summaryrefslogtreecommitdiffstats
path: root/mojo/public/bindings/generators/js_templates/module.js.tmpl
blob: 82c84ec6b0092092d9a7d945bd46cf15a832b1b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

define("{{module.path}}", [
    "mojo/apps/js/bindings/core",
    "mojo/apps/js/bindings/codec",
{%- for import in imports %}
    "{{import.module.path}}",
{%- endfor %}
  ], function(core, codec
{%- for import in imports -%}
    , {{import.unique_name}}
{%- endfor -%}
) {

{#--- Enums #}
{%  from "enum_definition.tmpl" import enum_def -%}
{%  for enum in enums %}
  var {{ enum_def(enum.name, enum, module) }}
{%-  endfor %}

{#--- Struct definitions #}
{%  for struct in structs %}
{%-   include "struct_definition.tmpl" %}
{%- endfor %}

{#--- Interface definitions #}
{%- for interface in interfaces %}
{%-   include "interface_definition.tmpl" %}
{%- endfor %}

  var exports = {};
{%- for enum in enums %}
  exports.{{enum.name}} = {{enum.name}};
{%- endfor %}
{%- for struct in structs if struct.exported %}
  exports.{{struct.name}} = {{struct.name}};
{%- endfor %}
{%- for interface in interfaces %}
  exports.{{interface.name}}Proxy = {{interface.name}}Proxy;
  exports.{{interface.name}}Stub = {{interface.name}}Stub;
{%- endfor %}
  return exports;
});