Skip to content

Commit 3881f9d

Browse files
committed
Fixes to build with Closure (--closure 1)
1 parent 3319a31 commit 3881f9d

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

src/closure-externs/closure-externs.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,12 @@ var moduleArg;
260260
*/
261261
Navigator.prototype.webkitGetUserMedia = function(
262262
constraints, successCallback, errorCallback) {};
263+
264+
/**
265+
* Global object for custom event target mappings, see:
266+
* https://emscripten.org/docs/api_reference/html5.h.html#how-to-use-this-api
267+
*
268+
* @type {Object}
269+
* @suppress {duplicate}
270+
*/
271+
var specialHTMLTargets;

src/library_browser.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ var LibraryBrowser = {
138138
#endif
139139
var img = new Image();
140140
img.onload = () => {
141+
#if ASSERTIONS
141142
assert(img.complete, `Image ${name} could not be decoded`);
143+
#endif
142144
var canvas = /** @type {!HTMLCanvasElement} */ (document.createElement('canvas'));
143145
canvas.width = img.width;
144146
canvas.height = img.height;
@@ -302,8 +304,9 @@ var LibraryBrowser = {
302304
if (!ctx) return null;
303305

304306
if (setInModule) {
307+
#if ASSERTIONS
305308
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');
306-
309+
#endif
307310
Module.ctx = ctx;
308311
if (useWebGL) GL.makeContextCurrent(contextHandle);
309312
Module.useWebGL = useWebGL;
@@ -783,8 +786,9 @@ var LibraryBrowser = {
783786
return onerror ? onerror() : undefined;
784787
}
785788
#endif
789+
#if ASSERTIONS
786790
assert(runDependencies === 0, 'async_load_script must be run when no other dependencies are active');
787-
791+
#endif
788792
{{{ runtimeKeepalivePush() }}}
789793

790794
var loadDone = () => {
@@ -911,8 +915,9 @@ var LibraryBrowser = {
911915
* @param {boolean=} noSetTiming
912916
*/`,
913917
$setMainLoop: (browserIterationFunc, fps, simulateInfiniteLoop, arg, noSetTiming) => {
918+
#if ASSERTIONS
914919
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.');
915-
920+
#endif
916921
Browser.mainLoop.func = browserIterationFunc;
917922
Browser.mainLoop.arg = arg;
918923

src/library_idbfs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ addToLibrary({
1616
if (typeof indexedDB != 'undefined') return indexedDB;
1717
var ret = null;
1818
if (typeof window == 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
19+
#if ASSERTIONS
1920
assert(ret, 'IDBFS used, but indexedDB not supported');
21+
#endif
2022
return ret;
2123
},
2224
DB_VERSION: 21,

0 commit comments

Comments
 (0)