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

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

Issue 2777083002: Revert of Mojo JS bindings: support auto-loading mojom.js deps. (Closed)
Patch Set: 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
« no previous file with comments | « mojo/public/js/new_bindings/base.js ('k') | mojo/public/tools/bindings/generators/mojom_js_generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f04ee993f2b3cf9ddcd0e20c5259e070d7b188b2..cf349765ac067c8edd81e84529b58ebfa96cec25 100644
--- a/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl
+++ b/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl
@@ -4,32 +4,16 @@
{%- if use_new_js_bindings %}
-'use strict';
+"use strict";
(function() {
- var mojomId = '{{module.path}}';
- if (mojoBindings.internal.isMojomLoaded(mojomId)) {
- console.warn('The following mojom is loaded multiple times: ' + mojomId);
- return;
- }
- mojoBindings.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 = mojoBindings;
var codec = mojoBindings.internal;
var validator = mojoBindings.internal;
-
{%- for import in imports %}
- var {{import.unique_name}} =
- mojoBindings.internal.exposeNamespace('{{import.module.namespace}}');
- if (mojoBindings.config.autoLoadMojomDeps) {
- mojoBindings.internal.loadMojomIfNecessary(
- '{{import.module.path}}',
- new URL(
- '{{import.module|get_relative_path(module)}}.js',
- document.currentScript.src).href);
- }
+ var {{import.unique_name}} = {{import.module.namespace}};
{%- endfor %}
{% include "module_definition.tmpl" %}
@@ -61,4 +45,4 @@
return exports;
});
-{%- endif %}
+{%- endif %}
« no previous file with comments | « mojo/public/js/new_bindings/base.js ('k') | mojo/public/tools/bindings/generators/mojom_js_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698