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

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

Issue 628763002: Mojo JS bindings: simplify mojo.connectToService() usage - Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored scoped enums and constants, moved interface def 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/js_templates/module.js.tmpl
diff --git a/mojo/public/tools/bindings/generators/js_templates/module.js.tmpl b/mojo/public/tools/bindings/generators/js_templates/module.js.tmpl
index 93fa537023dddb7683fe24bab0a297244c3b32e6..4f777694491ac173a9a936f89a5978ed59f9a55c 100644
--- a/mojo/public/tools/bindings/generators/js_templates/module.js.tmpl
+++ b/mojo/public/tools/bindings/generators/js_templates/module.js.tmpl
@@ -22,7 +22,7 @@ define("{{module.path}}", [
{#--- Enums #}
{%- from "enum_definition.tmpl" import enum_def %}
{%- for enum in enums %}
- var {{ enum_def(enum.name, enum, module) }}
+ var {{ enum_def(enum.name, enum) }}
{%- endfor %}
{#--- Struct definitions #}
@@ -46,8 +46,23 @@ define("{{module.path}}", [
exports.{{struct.name}} = {{struct.name}};
{%- endfor %}
{%- for interface in interfaces %}
- exports.{{interface.name}}Proxy = {{interface.name}}Proxy;
- exports.{{interface.name}}Stub = {{interface.name}}Stub;
+ exports.{{interface.name}} = {{interface.name}};
+{#--- Interface Enums #}
Matt Perry 2014/10/06 19:13:27 I think these enum and constant definitions belong
+{%- from "enum_definition.tmpl" import enum_def -%}
+
+{#--- Interface Constants #}
+{%- for constant in interface.constants %}
+ exports.{{interface.name}}.{{constant.name}} = {{constant.value|expression_to_text}},
+{%- endfor %}
+{#--- Interface Enums #}
+{%- for enum in interface.enums %}
+ {{ enum_def("exports.%s.%s"|format(interface.name, enum.name), enum) }}
+{%- endfor %}
+{#--- Interface Client #}
+{%- if interface.client in interfaces|map(attribute='name') %}
+ exports.{{interface.name}}.client = {{interface.client}};
+{%- endif %}
{%- endfor %}
+
return exports;
});

Powered by Google App Engine
This is Rietveld 408576698