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

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

Issue 2759563004: Mojo JS bindings: change module loading solution. (Closed)
Patch Set: Make sure mojo_bindings.js is packaged in build result for running layout tests. 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 side-by-side diff with in-line comments
Download patch
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 ddfef72bcc938746446cedf1b3d137ab00088214..a119ee9480f0725a4afac7ba0b26567e48e5611c 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,8 +25,13 @@
{%- include "interface_definition.tmpl" %}
{%- endfor %}
+{%- if use_new_js_bindings %}
+ var exports = mojo.internal.exposeNamespace("{{module.namespace}}");
+{%- else %}
var exports = {};
-{%- for constant in module.constants %}
+{%- endif %}
+
+{%- for constant in module.constants %}
exports.{{constant.name}} = {{constant.name}};
{%- endfor %}
{%- for enum in enums %}
@@ -41,10 +46,4 @@
{%- 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 %}

Powered by Google App Engine
This is Rietveld 408576698