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
6175 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
/**
68
* @param {number=} maxWaitMilliseconds
69
* @suppress {duplicate, checkTypes}
70
*/
71
Atomics.waitAsync = function(i32a, index, value, maxWaitMilliseconds) {};
72
Atomics.notify = function() {};
73
Atomics.load = function() {};
74
Atomics.store = function() {};
75
76
/**
77
* @const
78
* @suppress {duplicate, checkTypes}
79
*/
80
var WebAssembly = {};
81
/**
82
* @constructor
83
* @param {Object} globalDescriptor
84
* @param {*=} value
85
*/
86
WebAssembly.Global = function(globalDescriptor, value) {};
87
/**
88
* @param {!WebAssembly.Tag} tag
89
* @param {number} index
90
*/
91
WebAssembly.Exception.getArg = function(tag, index) {};
92
/**
93
* @param {!WebAssembly.Tag} tag
94
*/
95
WebAssembly.Exception.is = function(tag) {};
96
/**
97
* @type {string}
98
*/
99
WebAssembly.Exception.stack;
100
101
/**
102
* Note: Closure compiler does not support function overloading, omit this overload for now.
103
* {function(!WebAssembly.Module, Object=):!Promise<!WebAssembly.Instance>}
104
*/
105
/** @dict */
106
WebAssembly.Instance.prototype.exports;
107
/**
108
* @type {!ArrayBuffer}
109
*/
110
WebAssembly.Memory.prototype.buffer;
111
/**
112
* @returns {ArrayBuffer}
113
*/
114
WebAssembly.Memory.prototype.toResizableBuffer = function() {};
115
/**
116
* @type {number}
117
*/
118
WebAssembly.Table.prototype.length;
119
/**
120
* @param {!Function} func
121
* @returns {Function}
122
*/
123
WebAssembly.promising = function(func) {};
124
/**
125
* @constructor
126
* @param {!Function} func
127
*/
128
WebAssembly.Suspending = function(func) {};
129
130
/**
131
* @record
132
*/
133
function FunctionType() {}
134
/**
135
* @type {Array<string>}
136
*/
137
FunctionType.prototype.parameters;
138
/**
139
* @type {Array<string>}
140
*/
141
FunctionType.prototype.results;
142
143
/**
144
* @constructor
145
* @param {!FunctionType} type
146
* @param {!Function} func
147
*/
148
WebAssembly.Function = function(type, func) {};
149
/**
150
* @param {Function} func
151
* @return {FunctionType}
152
*/
153
WebAssembly.Function.type = function(func) {};
154
155
/**
156
* @suppress {undefinedVars}
157
*/
158
var wakaUnknownAfter;
159
/**
160
* @suppress {undefinedVars}
161
*/
162
var wakaUnknownBefore;
163
164
// Module loaders externs, for AMD etc.
165
166
/**
167
* @param {Function} wrapper
168
*/
169
var define = function (wrapper) {};
170
171
/**
172
* @type {Worker}
173
*/
174
var worker;
175
176
/**
177
* @param {Object} message
178
*/
179
var onmessage = function(message) {};
180
var onmessageerror = function() {};
181
182
/**
183
* @param {string} type
184
* @param {!Function} listener
185
* @param {Object|boolean=} optionsOrUseCapture
186
*/
187
var addEventListener = function (type, listener, optionsOrUseCapture) {};
188
189
/**
190
* @param {string} type
191
* @param {!Function} listener
192
*/
193
var removeEventListener = function (type, listener) {};
194
195
/**
196
* @type {Function}
197
*/
198
var close;
199
200
// Closure run on asm.js uses a hack to execute only on shell code, declare externs needed for it.
201
/**
202
* @suppress {undefinedVars}
203
*/
204
var wakaGlobal;
205
/**
206
* @suppress {undefinedVars}
207
*/
208
var wakaEnv;
209
/**
210
* @suppress {undefinedVars}
211
*/
212
var wakaBuffer;
213
214
215
// Browser externs on global window object.
216
var pageXOffset;
217
var pageYOffset;
218
var innerWidth;
219
var innerHeight;
220
var outerWidth;
221
var outerHeight;
222
var event;
223
var devicePixelRatio;
224
225
/*
226
* Avoid closure minifying anything to "id". See #13965
227
*/
228
var id;
229
230
/**
231
* Used in MODULARIZE mode as the name of the incoming module argument.
232
* This is generated outside of the code we pass to closure so from closure's
233
* POV this is "extern".
234
*/
235
var moduleArg;
236
237
/**
238
* Used in MODULARIZE mode.
239
* We need to access this after the code we pass to closure so from closure's
240
* POV this is "extern".
241
*/
242
var moduleRtn;
243
244
/**
245
* This was removed from upstream closure compiler in
246
* https://github.com/google/closure-compiler/commit/f83322c1b.
247
* Perhaps we should remove it too?
248
*
249
* @param {MediaStreamConstraints} constraints A MediaStreamConstraints object.
250
* @param {function(!MediaStream)} successCallback
251
* A NavigatorUserMediaSuccessCallback function.
252
* @param {function(!NavigatorUserMediaError)=} errorCallback A
253
* NavigatorUserMediaErrorCallback function.
254
* @see http://dev.w3.org/2011/webrtc/editor/getusermedia.html
255
* @see https://www.w3.org/TR/mediacapture-streams/
256
* @return {undefined}
257
*/
258
Navigator.prototype.webkitGetUserMedia = function(
259
constraints, successCallback, errorCallback) {};
260
261
/**
262
* A symbol from the explicit resource management proposal that isn't yet part of Closure.
263
* @type {symbol}
264
*/
265
Symbol.dispose;
266
267
// Common between node-externs and v8-externs
268
var os = {};
269
270
AudioWorkletProcessor.parameterDescriptors;
271
272