1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5'use strict';
6
7(function() {
8  var mojomId = '{{module.path}}';
9  if (mojo.internal.isMojomLoaded(mojomId)) {
10    console.warn('The following mojom is loaded multiple times: ' + mojomId);
11    return;
12  }
13  mojo.internal.markMojomLoaded(mojomId);
14
15{#- TODO(crbug.com/795977): Change the media router extension to not mess with
16    the mojo namespace, so that we can refer to mojo directly. #}
17  var bindings = mojo;
18  var associatedBindings = mojo;
19  var codec = mojo.internal;
20  var validator = mojo.internal;
21
22  var exports = mojo.internal.exposeNamespace('{{module.namespace}}');
23
24{%- for import in imports %}
25  var {{import.unique_name}} =
26      mojo.internal.exposeNamespace('{{import.namespace}}');
27  if (mojo.config.autoLoadMojomDeps) {
28    mojo.internal.loadMojomIfNecessary(
29        '{{import.path}}', '{{import|get_relative_url(module)}}.js');
30  }
31{%- endfor %}
32
33{% include "module_definition.tmpl" %}
34})();
35