Path: blob/main/src/closure-externs/closure-externs.js
4130 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() {};66Atomics.notify = function() {};67Atomics.load = function() {};68Atomics.store = function() {};6970/**71* @const72* @suppress {duplicate, checkTypes}73*/74var WebAssembly = {};75/**76* @constructor77* @param {Object} globalDescriptor78* @param {*=} value79*/80WebAssembly.Global = function(globalDescriptor, value) {};81/**82* @param {!WebAssembly.Tag} tag83* @param {number} index84*/85WebAssembly.Exception.getArg = function(tag, index) {};86/**87* @param {!WebAssembly.Tag} tag88*/89WebAssembly.Exception.is = function(tag) {};90/**91* @type {string}92*/93WebAssembly.Exception.stack;9495/**96* Note: Closure compiler does not support function overloading, omit this overload for now.97* {function(!WebAssembly.Module, Object=):!Promise<!WebAssembly.Instance>}98*/99/** @dict */100WebAssembly.Instance.prototype.exports;101/**102* @type {!ArrayBuffer}103*/104WebAssembly.Memory.prototype.buffer;105/**106* @returns {ArrayBuffer}107*/108WebAssembly.Memory.prototype.toResizableBuffer = function() {};109/**110* @type {number}111*/112WebAssembly.Table.prototype.length;113/**114* @param {!Function} func115* @returns {Function}116*/117WebAssembly.promising = function(func) {};118/**119* @constructor120* @param {!Function} func121*/122WebAssembly.Suspending = function(func) {};123124/**125* @record126*/127function FunctionType() {}128/**129* @type {Array<string>}130*/131FunctionType.prototype.parameters;132/**133* @type {Array<string>}134*/135FunctionType.prototype.results;136137/**138* @constructor139* @param {!FunctionType} type140* @param {!Function} func141*/142WebAssembly.Function = function(type, func) {};143/**144* @param {Function} func145* @return {FunctionType}146*/147WebAssembly.Function.type = function(func) {};148149/**150* @suppress {undefinedVars}151*/152var wakaUnknownAfter;153/**154* @suppress {undefinedVars}155*/156var wakaUnknownBefore;157158// Module loaders externs, for AMD etc.159160/**161* @param {Function} wrapper162*/163var define = function (wrapper) {};164165/**166* @type {Worker}167*/168var worker;169170/**171* @param {Object} message172*/173var onmessage = function(message) {};174var onmessageerror = function() {};175176/**177* @param {string} type178* @param {!Function} listener179* @param {Object|boolean=} optionsOrUseCapture180*/181var addEventListener = function (type, listener, optionsOrUseCapture) {};182183/**184* @param {string} type185* @param {!Function} listener186*/187var removeEventListener = function (type, listener) {};188189/**190* @type {Function}191*/192var close;193194// Closure run on asm.js uses a hack to execute only on shell code, declare externs needed for it.195/**196* @suppress {undefinedVars}197*/198var wakaGlobal;199/**200* @suppress {undefinedVars}201*/202var wakaEnv;203/**204* @suppress {undefinedVars}205*/206var wakaBuffer;207208209// Browser externs on global window object.210var pageXOffset;211var pageYOffset;212var innerWidth;213var innerHeight;214var outerWidth;215var outerHeight;216var event;217var devicePixelRatio;218219/*220* AudioWorkletGlobalScope globals221*/222var registerProcessor = function(name, obj) {};223var currentFrame;224var currentTime;225var sampleRate;226227/*228* Avoid closure minifying anything to "id". See #13965229*/230var id;231232/**233* Used in MODULARIZE mode as the name of the incoming module argument.234* This is generated outside of the code we pass to closure so from closure's235* POV this is "extern".236*/237var moduleArg;238239/**240* Used in MODULARIZE mode.241* We need to access this after the code we pass to closure so from closure's242* POV this is "extern".243*/244var moduleRtn;245246/**247* This was removed from upstream closure compiler in248* https://github.com/google/closure-compiler/commit/f83322c1b.249* Perhaps we should remove it do?250*251* @param {MediaStreamConstraints} constraints A MediaStreamConstraints object.252* @param {function(!MediaStream)} successCallback253* A NavigatorUserMediaSuccessCallback function.254* @param {function(!NavigatorUserMediaError)=} errorCallback A255* NavigatorUserMediaErrorCallback function.256* @see http://dev.w3.org/2011/webrtc/editor/getusermedia.html257* @see https://www.w3.org/TR/mediacapture-streams/258* @return {undefined}259*/260Navigator.prototype.webkitGetUserMedia = function(261constraints, successCallback, errorCallback) {};262263/**264* A symbol from the explicit resource management proposal that isn't yet part of Closure.265* @type {symbol}266*/267Symbol.dispose;268269// Common between node-externs and v8-externs270var os = {};271272AudioWorkletProcessor.parameterDescriptors;273274275