Chromium Code Reviews| Index: mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl |
| diff --git a/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl b/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl |
| index 3ce4ab649623db0677ae0005c1e0ef83b2e9cdf4..7b2233fe88c7bc07fe06caeff4a8ed55441aeb8e 100644 |
| --- a/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl |
| +++ b/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl |
| @@ -2,26 +2,45 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +{%- if use_new_js_bindings %} |
| + |
| +(function() { |
| + // TODO(yzshen): Define these aliases to minimize the differences between the |
| + // old/new modes. Remove them when the old mode goes away. |
| + var bindings = mojoBindings; |
|
Ken Rockot(use gerrit already)
2017/03/20 15:27:20
optional nit: can we use let instead of var for ne
yzshen1
2017/03/20 17:45:02
Added "use strict".
IOS9 doesn't support "let" y
|
| + var codec = mojoBindings.internal; |
| + var validator = mojoBindings.internal; |
| +{%- for import in imports %} |
| + var {{import.unique_name}} = {{import.module.namespace}}; |
| +{%- endfor %} |
| + |
| +{% include "module_definition.tmpl" %} |
| +})(); |
| + |
| +{%- else %} |
| + |
| define("{{module.path}}", [ |
| -{%- if module.path != "mojo/public/interfaces/bindings/interface_control_messages.mojom" %} |
| +{%- if module.path != "mojo/public/interfaces/bindings/interface_control_messages.mojom" %} |
| "mojo/public/js/bindings", |
| -{%- endif %} |
| +{%- endif %} |
| "mojo/public/js/codec", |
| "mojo/public/js/core", |
| "mojo/public/js/validator", |
| -{%- for import in imports %} |
| +{%- for import in imports %} |
| "{{import.module.path}}", |
| -{%- endfor %} |
| +{%- endfor %} |
| ], function( |
| {%- if module.path != "mojo/public/interfaces/bindings/interface_control_messages.mojom" -%} |
| bindings, {% endif -%} |
| codec, core, validator |
| -{%- for import in imports -%} |
| +{%- for import in imports -%} |
| , {{import.unique_name}} |
| -{%- endfor -%} |
| +{%- endfor -%} |
| ) { |
| {%- include "module_definition.tmpl" %} |
| return exports; |
| }); |
| + |
| +{%- endif %} |