Path: blob/main/src/closure-externs/closure-externs.js
6175 views
/**1* Copyright 2014 The Emscripten Authors. All rights reserved.2* Emscripten is available under two separate licenses, the MIT license and the3* University of Illinois/NCSA Open Source License. Both these licenses can be4* found in the LICENSE file.5*6* This file contains definitions for things that we'd really rather the closure compiler *didn't* minify.7* See http://code.google.com/p/closure-compiler/wiki/FAQ#How_do_I_write_an_externs_file8* See also the discussion here: https://github.com/emscripten-core/emscripten/issues/19799*10* The closure_compiler() method in tools/shared.py refers to this file when calling closure.11*/1213// Special placeholder for `import.meta` and `await import`.14var EMSCRIPTEN$IMPORT$META;15var EMSCRIPTEN$AWAIT$IMPORT;16var EMSCRIPTEN$AWAIT;1718// Don't minify createRequire19var createRequire;2021// Closure externs used by library_sockfs.js2223/**24* Backported from latest closure...25* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/currentScript26*/27Document.prototype.currentScript;2829/**30* Don't minify Math.*31*/32/**33* @suppress {duplicate}34*/35var Math = {};36Math.abs = function() {};37Math.cos = function() {};38Math.sin = function() {};39Math.tan = function() {};40Math.acos = function() {};41Math.asin = function() {};42Math.atan = function() {};43Math.atan2 = function() {};44Math.exp = function() {};45Math.log = function() {};46Math.sqrt = function() {};47Math.ceil = function() {};48Math.floor = function() {};49Math.pow = function() {};50Math.imul = function() {};51Math.fround = function() {};52Math.round = function() {};53Math.min = function() {};54Math.max = function() {};55Math.clz32 = function() {};56Math.trunc = function() {};5758/**59* Atomics60*/6162var Atomics = {};63Atomics.compareExchange = function() {};64Atomics.exchange = function() {};65Atomics.wait = function() {};66/**67* @param {number=} maxWaitMilliseconds68* @suppress {duplicate, checkTypes}69*/70Atomics.waitAsync = function(i32a, index, value, maxWaitMilliseconds) {};71Atomics.notify = function() {};72Atomics.load = function() {};73Atomics.store = function() {};7475/**76* @const77* @suppress {duplicate, checkTypes}78*/79var WebAssembly = {};80/**81* @constructor82* @param {Object} globalDescriptor83* @param {*=} value84*/85WebAssembly.Global = function(globalDescriptor, value) {};86/**87* @param {!WebAssembly.Tag} tag88* @param {number} index89*/90WebAssembly.Exception.getArg = function(tag, index) {};91/**92* @param {!WebAssembly.Tag} tag93*/94WebAssembly.Exception.is = function(tag) {};95/**96* @type {string}97*/98WebAssembly.Exception.stack;99100/**101* Note: Closure compiler does not support function overloading, omit this overload for now.102* {function(!WebAssembly.Module, Object=):!Promise<!WebAssembly.Instance>}103*/104/** @dict */105WebAssembly.Instance.prototype.exports;106/**107* @type {!ArrayBuffer}108*/109WebAssembly.Memory.prototype.buffer;110/**111* @returns {ArrayBuffer}112*/113WebAssembly.Memory.prototype.toResizableBuffer = function() {};114/**115* @type {number}116*/117WebAssembly.Table.prototype.length;118/**119* @param {!Function} func120* @returns {Function}121*/122WebAssembly.promising = function(func) {};123/**124* @constructor125* @param {!Function} func126*/127WebAssembly.Suspending = function(func) {};128129/**130* @record131*/132function FunctionType() {}133/**134* @type {Array<string>}135*/136FunctionType.prototype.parameters;137/**138* @type {Array<string>}139*/140FunctionType.prototype.results;141142/**143* @constructor144* @param {!FunctionType} type145* @param {!Function} func146*/147WebAssembly.Function = function(type, func) {};148/**149* @param {Function} func150* @return {FunctionType}151*/152WebAssembly.Function.type = function(func) {};153154/**155* @suppress {undefinedVars}156*/157var wakaUnknownAfter;158/**159* @suppress {undefinedVars}160*/161var wakaUnknownBefore;162163// Module loaders externs, for AMD etc.164165/**166* @param {Function} wrapper167*/168var define = function (wrapper) {};169170/**171* @type {Worker}172*/173var worker;174175/**176* @param {Object} message177*/178var onmessage = function(message) {};179var onmessageerror = function() {};180181/**182* @param {string} type183* @param {!Function} listener184* @param {Object|boolean=} optionsOrUseCapture185*/186var addEventListener = function (type, listener, optionsOrUseCapture) {};187188/**189* @param {string} type190* @param {!Function} listener191*/192var removeEventListener = function (type, listener) {};193194/**195* @type {Function}196*/197var close;198199// Closure run on asm.js uses a hack to execute only on shell code, declare externs needed for it.200/**201* @suppress {undefinedVars}202*/203var wakaGlobal;204/**205* @suppress {undefinedVars}206*/207var wakaEnv;208/**209* @suppress {undefinedVars}210*/211var wakaBuffer;212213214// Browser externs on global window object.215var pageXOffset;216var pageYOffset;217var innerWidth;218var innerHeight;219var outerWidth;220var outerHeight;221var event;222var devicePixelRatio;223224/*225* Avoid closure minifying anything to "id". See #13965226*/227var id;228229/**230* Used in MODULARIZE mode as the name of the incoming module argument.231* This is generated outside of the code we pass to closure so from closure's232* POV this is "extern".233*/234var moduleArg;235236/**237* Used in MODULARIZE mode.238* We need to access this after the code we pass to closure so from closure's239* POV this is "extern".240*/241var moduleRtn;242243/**244* This was removed from upstream closure compiler in245* https://github.com/google/closure-compiler/commit/f83322c1b.246* Perhaps we should remove it too?247*248* @param {MediaStreamConstraints} constraints A MediaStreamConstraints object.249* @param {function(!MediaStream)} successCallback250* A NavigatorUserMediaSuccessCallback function.251* @param {function(!NavigatorUserMediaError)=} errorCallback A252* NavigatorUserMediaErrorCallback function.253* @see http://dev.w3.org/2011/webrtc/editor/getusermedia.html254* @see https://www.w3.org/TR/mediacapture-streams/255* @return {undefined}256*/257Navigator.prototype.webkitGetUserMedia = function(258constraints, successCallback, errorCallback) {};259260/**261* A symbol from the explicit resource management proposal that isn't yet part of Closure.262* @type {symbol}263*/264Symbol.dispose;265266// Common between node-externs and v8-externs267var os = {};268269AudioWorkletProcessor.parameterDescriptors;270271272