Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/src/closure-externs/closure-externs.js
4130 views
1
/**
2
* Copyright 2014 The Emscripten Authors. All rights reserved.
3
* Emscripten is available under two separate licenses, the MIT license and the
4
* University of Illinois/NCSA Open Source License. Both these licenses can be
5
* found in the LICENSE file.
6
*
7
* This file contains definitions for things that we'd really rather the closure compiler *didn't* minify.
8
* See http://code.google.com/p/closure-compiler/wiki/FAQ#How_do_I_write_an_externs_file
9
* See also the discussion here: https://github.com/emscripten-core/emscripten/issues/1979
10
*
11
* The closure_compiler() method in tools/shared.py refers to this file when calling closure.
12
*/
13
14
// Special placeholder for `import.meta` and `await import`.
15
var EMSCRIPTEN$IMPORT$META;
16
var EMSCRIPTEN$AWAIT$IMPORT;
17
var EMSCRIPTEN$AWAIT;
18
19
// Don't minify createRequire
20
var createRequire;
21
22
// Closure externs used by library_sockfs.js
23
24
/**
25
* Backported from latest closure...
26
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/currentScript
27
*/
28
Document.prototype.currentScript;
29
30
/**
31
* Don't minify Math.*
32
*/
33
/**
34
* @suppress {duplicate}
35
*/
36
var Math = {};
37
Math.abs = function() {};
38
Math.cos = function() {};
39
Math.sin = function() {};
40
Math.tan = function() {};
41
Math.acos = function() {};
42
Math.asin = function() {};
43
Math.atan = function() {};
44
Math.atan2 = function() {};
45
Math.exp = function() {};
46
Math.log = function() {};
47
Math.sqrt = function() {};
48
Math.ceil = function() {};
49
Math.floor = function() {};
50
Math.pow = function() {};
51
Math.imul = function() {};
52
Math.fround = function() {};
53
Math.round = function() {};
54
Math.min = function() {};
55
Math.max = function() {};
56
Math.clz32 = function() {};
57
Math.trunc = function() {};
58
59
/**
60
* Atomics
61
*/
62
63
var Atomics = {};
64
Atomics.compareExchange = function() {};
65
Atomics.exchange = function() {};
66
Atomics.wait = function() {};
67
Atomics.notify = function() {};
68
Atomics.load = function() {};
69
Atomics.store = function() {};
70
71
/**
72
* @const
73
* @suppress {duplicate, checkTypes}
74
*/
75
var WebAssembly = {};
76
/**
77
* @constructor
78
* @param {Object} globalDescriptor
79
* @param {*=} value
80
*/
81
WebAssembly.Global = function(globalDescriptor, value) {};
82
/**
83
* @param {!WebAssembly.Tag} tag
84
* @param {number} index
85
*/
86
WebAssembly.Exception.getArg = function(tag, index) {};
87
/**
88
* @param {!WebAssembly.Tag} tag
89
*/
90
WebAssembly.Exception.is = function(tag) {};
91
/**
92
* @type {string}
93
*/
94
WebAssembly.Exception.stack;
95
96
/**
97
* Note: Closure compiler does not support function overloading, omit this overload for now.
98
* {function(!WebAssembly.Module, Object=):!Promise<!WebAssembly.Instance>}
99
*/
100
/** @dict */
101
WebAssembly.Instance.prototype.exports;
102
/**
103
* @type {!ArrayBuffer}
104
*/
105
WebAssembly.Memory.prototype.buffer;
106
/**
107
* @returns {ArrayBuffer}
108
*/
109
WebAssembly.Memory.prototype.toResizableBuffer = function() {};
110
/**
111
* @type {number}
112
*/
113
WebAssembly.Table.prototype.length;
114
/**
115
* @param {!Function} func
116
* @returns {Function}
117
*/
118
WebAssembly.promising = function(func) {};
119
/**
120
* @constructor
121
* @param {!Function} func
122
*/
123
WebAssembly.Suspending = function(func) {};
124
125
/**
126
* @record
127
*/
128
function FunctionType() {}
129
/**
130
* @type {Array<string>}
131
*/
132
FunctionType.prototype.parameters;
133
/**
134
* @type {Array<string>}
135
*/
136
FunctionType.prototype.results;
137
138
/**
139
* @constructor
140
* @param {!FunctionType} type
141
* @param {!Function} func
142
*/
143
WebAssembly.Function = function(type, func) {};
144
/**
145
* @param {Function} func
146
* @return {FunctionType}
147
*/
148
WebAssembly.Function.type = function(func) {};
149
150
/**
151
* @suppress {undefinedVars}
152
*/
153
var wakaUnknownAfter;
154
/**
155
* @suppress {undefinedVars}
156
*/
157
var wakaUnknownBefore;
158
159
// Module loaders externs, for AMD etc.
160
161
/**
162
* @param {Function} wrapper
163
*/
164
var define = function (wrapper) {};
165
166
/**
167
* @type {Worker}
168
*/
169
var worker;
170
171
/**
172
* @param {Object} message
173
*/
174
var onmessage = function(message) {};
175
var onmessageerror = function() {};
176
177
/**
178
* @param {string} type
179
* @param {!Function} listener
180
* @param {Object|boolean=} optionsOrUseCapture
181
*/
182
var addEventListener = function (type, listener, optionsOrUseCapture) {};
183
184
/**
185
* @param {string} type
186
* @param {!Function} listener
187
*/
188
var removeEventListener = function (type, listener) {};
189
190
/**
191
* @type {Function}
192
*/
193
var close;
194
195
// Closure run on asm.js uses a hack to execute only on shell code, declare externs needed for it.
196
/**
197
* @suppress {undefinedVars}
198
*/
199
var wakaGlobal;
200
/**
201
* @suppress {undefinedVars}
202
*/
203
var wakaEnv;
204
/**
205
* @suppress {undefinedVars}
206
*/
207
var wakaBuffer;
208
209
210
// Browser externs on global window object.
211
var pageXOffset;
212
var pageYOffset;
213
var innerWidth;
214
var innerHeight;
215
var outerWidth;
216
var outerHeight;
217
var event;
218
var devicePixelRatio;
219
220
/*
221
* AudioWorkletGlobalScope globals
222
*/
223
var registerProcessor = function(name, obj) {};
224
var currentFrame;
225
var currentTime;
226
var sampleRate;
227
228
/*
229
* Avoid closure minifying anything to "id". See #13965
230
*/
231
var id;
232
233
/**
234
* Used in MODULARIZE mode as the name of the incoming module argument.
235
* This is generated outside of the code we pass to closure so from closure's
236
* POV this is "extern".
237
*/
238
var moduleArg;
239
240
/**
241
* Used in MODULARIZE mode.
242
* We need to access this after the code we pass to closure so from closure's
243
* POV this is "extern".
244
*/
245
var moduleRtn;
246
247
/**
248
* This was removed from upstream closure compiler in
249
* https://github.com/google/closure-compiler/commit/f83322c1b.
250
* Perhaps we should remove it do?
251
*
252
* @param {MediaStreamConstraints} constraints A MediaStreamConstraints object.
253
* @param {function(!MediaStream)} successCallback
254
* A NavigatorUserMediaSuccessCallback function.
255
* @param {function(!NavigatorUserMediaError)=} errorCallback A
256
* NavigatorUserMediaErrorCallback function.
257
* @see http://dev.w3.org/2011/webrtc/editor/getusermedia.html
258
* @see https://www.w3.org/TR/mediacapture-streams/
259
* @return {undefined}
260
*/
261
Navigator.prototype.webkitGetUserMedia = function(
262
constraints, successCallback, errorCallback) {};
263
264
/**
265
* A symbol from the explicit resource management proposal that isn't yet part of Closure.
266
* @type {symbol}
267
*/
268
Symbol.dispose;
269
270
// Common between node-externs and v8-externs
271
var os = {};
272
273
AudioWorkletProcessor.parameterDescriptors;
274
275