diff options
Diffstat (limited to 'themes/dist/output.js')
-rw-r--r-- | themes/dist/output.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/themes/dist/output.js b/themes/dist/output.js index 80389ba..01fdfb4 100644 --- a/themes/dist/output.js +++ b/themes/dist/output.js @@ -2036,6 +2036,52 @@ var ASM_CONSTS = { return 0; } + function registerUiEventCallback(target, userData, useCapture, callbackfunc, eventTypeId, eventTypeString, targetThread) { + if (!JSEvents.uiEvent) JSEvents.uiEvent = _malloc( 36 ); + + target = findEventTarget(target); + + var uiEventHandlerFunc = function(ev) { + var e = ev || event; + if (e.target != target) { + // Never take ui events such as scroll via a 'bubbled' route, but always from the direct element that + // was targeted. Otherwise e.g. if app logs a message in response to a page scroll, the Emscripten log + // message box could cause to scroll, generating a new (bubbled) scroll message, causing a new log print, + // causing a new scroll, etc.. + return; + } + var b = document.body; // Take document.body to a variable, Closure compiler does not outline access to it on its own. + if (!b) { + // During a page unload 'body' can be null, with "Cannot read property 'clientWidth' of null" being thrown + return; + } + var uiEvent = JSEvents.uiEvent; + HEAP32[((uiEvent)>>2)] = e.detail; + HEAP32[(((uiEvent)+(4))>>2)] = b.clientWidth; + HEAP32[(((uiEvent)+(8))>>2)] = b.clientHeight; + HEAP32[(((uiEvent)+(12))>>2)] = innerWidth; + HEAP32[(((uiEvent)+(16))>>2)] = innerHeight; + HEAP32[(((uiEvent)+(20))>>2)] = outerWidth; + HEAP32[(((uiEvent)+(24))>>2)] = outerHeight; + HEAP32[(((uiEvent)+(28))>>2)] = pageXOffset; + HEAP32[(((uiEvent)+(32))>>2)] = pageYOffset; + if (wasmTable.get(callbackfunc)(eventTypeId, uiEvent, userData)) e.preventDefault(); + }; + + var eventHandler = { + target: target, + eventTypeString: eventTypeString, + callbackfunc: callbackfunc, + handlerFunc: uiEventHandlerFunc, + useCapture: useCapture + }; + JSEvents.registerOrRemoveHandler(eventHandler); + } + function _emscripten_set_resize_callback_on_thread(target, userData, useCapture, callbackfunc, targetThread) { + registerUiEventCallback(target, userData, useCapture, callbackfunc, 10, "resize", targetThread); + return 0; + } + function __webgl_enable_ANGLE_instanced_arrays(ctx) { // Extension available in WebGL 1 from Firefox 26 and Google Chrome 30 onwards. Core feature in WebGL 2. var ext = ctx.getExtension('ANGLE_instanced_arrays'); @@ -2942,6 +2988,7 @@ var asmLibraryArg = { "emscripten_resize_heap": _emscripten_resize_heap, "emscripten_set_canvas_element_size": _emscripten_set_canvas_element_size, "emscripten_set_click_callback_on_thread": _emscripten_set_click_callback_on_thread, + "emscripten_set_resize_callback_on_thread": _emscripten_set_resize_callback_on_thread, "emscripten_webgl_create_context": _emscripten_webgl_create_context, "emscripten_webgl_init_context_attributes": _emscripten_webgl_init_context_attributes, "emscripten_webgl_make_context_current": _emscripten_webgl_make_context_current, |