| 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 7eadbe338c5f59e2ee6eef8851a7a36809ea5e16..3637b196ac0add92519244fcb54b4fa191713b0b 100644
|
| --- a/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl
|
| +++ b/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl
|
| @@ -4,16 +4,32 @@
|
|
|
| {%- if use_new_js_bindings %}
|
|
|
| -"use strict";
|
| +'use strict';
|
|
|
| (function() {
|
| + var mojomId = '{{module.path}}';
|
| + if (mojo.internal.isMojomLoaded(mojomId)) {
|
| + console.warn('The following mojom is loaded multiple times: ' + mojomId);
|
| + return;
|
| + }
|
| + mojo.internal.markMojomLoaded(mojomId);
|
| +
|
| // TODO(yzshen): Define these aliases to minimize the differences between the
|
| // old/new modes. Remove them when the old mode goes away.
|
| var bindings = mojo;
|
| var codec = mojo.internal;
|
| var validator = mojo.internal;
|
| +
|
| {%- for import in imports %}
|
| - var {{import.unique_name}} = {{import.module.namespace}};
|
| + var {{import.unique_name}} =
|
| + mojo.internal.exposeNamespace('{{import.module.namespace}}');
|
| + if (mojo.config.autoLoadMojomDeps) {
|
| + mojo.internal.loadMojomIfNecessary(
|
| + '{{import.module.path}}',
|
| + new URL(
|
| + '{{import.module|get_relative_path(module)}}.js',
|
| + document.currentScript.src).href);
|
| + }
|
| {%- endfor %}
|
|
|
| {% include "module_definition.tmpl" %}
|
|
|