-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathwrapper.template.js
52 lines (45 loc) · 1.87 KB
/
wrapper.template.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*! @license
* Shaka Player
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
(function() {
// This is "window" in browsers and "global" in nodejs.
// See https://github.com/shaka-project/shaka-player/issues/1445
var innerGlobal = typeof window != 'undefined' ? window : global;
// This is where our library exports things to. It is "this" in the wrapped
// code. With this, we can decide later what module loader we are in, if any,
// and put these exports in the appropriate place for that loader.
var exportTo = {};
// According to the Closure team, their polyfills will be written to
// $jscomp.global, which will be "window", or "global", or "this", depending
// on circumstances.
// See https://github.com/google/closure-compiler/issues/2957 and
// https://github.com/shaka-project/shaka-player/issues/1455#issuecomment-393250035
// We provide "global" for use by Closure, and "window" for use by the Shaka
// library itself. Both point to "innerGlobal" above.
// We also provide "module", which is always undefined, to prevent compiled-in
// code from doing its own exports that conflict with ours.
(function(window, global, module) {
%output%
}).call(/* this= */ exportTo,
/* window= */ innerGlobal,
/* global= */ innerGlobal,
/* module= */ undefined);
if (typeof exports != 'undefined') {
// CommonJS module loader. Use "exports" instead of "module.exports" to
// avoid triggering inappropriately in Electron.
for (var k in exportTo.shaka) {
exports[k] = exportTo.shaka[k];
}
} else if (typeof define == 'function' && define.amd) {
// AMD module loader.
define(function(){
return exportTo.shaka;
});
} else {
// Loaded as an ES module or directly in a <script> tag.
// Export directly to the global scope.
innerGlobal.shaka = exportTo.shaka;
}
})();