chromium/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

'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(crbug.com/41361453): Change the media router extension to not mess with
    the mojo namespace, so that we can refer to mojo directly. #}
  var bindings = mojo;
  var associatedBindings = mojo;
  var codec = mojo.internal;
  var validator = mojo.internal;

  var exports = mojo.internal.exposeNamespace('{{module.namespace}}');

{%- for import in imports %}
  var {{import.unique_name}} =
      mojo.internal.exposeNamespace('{{import.namespace}}');
  if (mojo.config.autoLoadMojomDeps) {
    mojo.internal.loadMojomIfNecessary(
        '{{import.path}}', '{{import|get_relative_url(module)}}.js');
  }
{%- endfor %}

{% include "module_definition.tmpl" %}
})();