Skip to content

Commit

Permalink
Fixes to build with Closure (--closure 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwoffenden committed Feb 23, 2024
1 parent 135baa3 commit c993e3d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/closure-externs/closure-externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,12 @@ var moduleArg;
*/
Navigator.prototype.webkitGetUserMedia = function(
constraints, successCallback, errorCallback) {};

/**
* Global object for custom event target mappings, see:
* https://emscripten.org/docs/api_reference/html5.h.html#how-to-use-this-api
*
* @type {Object}
* @suppress {duplicate}
*/
var specialHTMLTargets;
11 changes: 8 additions & 3 deletions src/library_browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ var LibraryBrowser = {
#endif
var img = new Image();
img.onload = () => {
#if ASSERTIONS
assert(img.complete, `Image ${name} could not be decoded`);
#endif
var canvas = /** @type {!HTMLCanvasElement} */ (document.createElement('canvas'));
canvas.width = img.width;
canvas.height = img.height;
Expand Down Expand Up @@ -302,8 +304,9 @@ var LibraryBrowser = {
if (!ctx) return null;

if (setInModule) {
#if ASSERTIONS
if (!useWebGL) assert(typeof GLctx == 'undefined', 'cannot set in module if GLctx is used, but we are a non-GL context that would replace it');

#endif
Module.ctx = ctx;
if (useWebGL) GL.makeContextCurrent(contextHandle);
Module.useWebGL = useWebGL;
Expand Down Expand Up @@ -783,8 +786,9 @@ var LibraryBrowser = {
return onerror ? onerror() : undefined;
}
#endif
#if ASSERTIONS
assert(runDependencies === 0, 'async_load_script must be run when no other dependencies are active');

#endif
{{{ runtimeKeepalivePush() }}}

var loadDone = () => {
Expand Down Expand Up @@ -911,8 +915,9 @@ var LibraryBrowser = {
* @param {boolean=} noSetTiming
*/`,
$setMainLoop: (browserIterationFunc, fps, simulateInfiniteLoop, arg, noSetTiming) => {
#if ASSERTIONS
assert(!Browser.mainLoop.func, 'emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.');

#endif
Browser.mainLoop.func = browserIterationFunc;
Browser.mainLoop.arg = arg;

Expand Down
2 changes: 2 additions & 0 deletions src/library_idbfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ addToLibrary({
if (typeof indexedDB != 'undefined') return indexedDB;
var ret = null;
if (typeof window == 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
#if ASSERTIONS
assert(ret, 'IDBFS used, but indexedDB not supported');
#endif
return ret;
},
DB_VERSION: 21,
Expand Down

0 comments on commit c993e3d

Please sign in to comment.