Index: mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl |
diff --git a/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl b/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl |
index 5abcf34fb5140d77b720765dc8c4ee315fe04340..ddfef72bcc938746446cedf1b3d137ab00088214 100644 |
--- a/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl |
+++ b/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl |
@@ -1,5 +1,5 @@ |
{#--- Constants #} |
-{%- for constant in module.constants %} |
+{%- for constant in module.constants %} |
var {{constant.name}} = {{constant.value|expression_to_text}}; |
{%- endfor %} |
@@ -25,13 +25,8 @@ |
{%- include "interface_definition.tmpl" %} |
{%- endfor %} |
-{%- if use_new_js_bindings %} |
- var exports = mojoBindings.internal.exposeNamespace("{{module.namespace}}"); |
-{%- else %} |
var exports = {}; |
-{%- endif %} |
- |
-{%- for constant in module.constants %} |
+{%- for constant in module.constants %} |
exports.{{constant.name}} = {{constant.name}}; |
{%- endfor %} |
{%- for enum in enums %} |
@@ -46,4 +41,10 @@ |
{%- for interface in interfaces %} |
exports.{{interface.name}} = {{interface.name}}; |
exports.{{interface.name}}Ptr = {{interface.name}}Ptr; |
+{#--- Interface Client #} |
+{%- if interface.client in interfaces|map(attribute='name') %} |
+ exports.{{interface.name}}.client = {{interface.client}}; |
+{%- elif interface.client in imported_interfaces %} |
+ exports.{{interface.name}}.client = {{imported_interfaces[interface.client]}}; |
+{%- endif %} |
{%- endfor %} |