MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / hookGlobalSymbolAccess

Function hookGlobalSymbolAccess

src/runtime_debug.js:116–126  ·  view source on GitHub ↗

* Intercept access to a symbols in the global symbol. This enables us to give * informative warnings/errors when folks attempt to use symbols they did not * include in their build, or no symbols that no longer exist. * * We don't define this in MODULARIZE mode since in that mode emscripten symb

(sym, func)

Source from the content-addressed store, hash-verified

114 * are never placed in the global scope.
115 */
116function hookGlobalSymbolAccess(sym, func) {
117 if (!Object.getOwnPropertyDescriptor(globalThis, sym)) {
118 Object.defineProperty(globalThis, sym, {
119 configurable: true,
120 get() {
121 func();
122 return undefined;
123 }
124 });
125 }
126}
127
128function missingGlobal(sym, msg) {
129 hookGlobalSymbolAccess(sym, () => {

Callers 2

missingGlobalFunction · 0.70
missingLibrarySymbolFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected