mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
js: Simpler and more robust startup procedure
Previously, we initialised all of the JavaScript event handlers as soon at the DOM was loaded, and then called main() ourselves once the Emscripten runtime was ready. This was slightly dangerous since it depended on none of those event handlers' being called before main(). In practice this was difficult because most of the elements the event handlers were attached to were invisible, but it did limit what event handlers could safely be used. Now, the event handlers are initialised from main(). This makes things work in a sufficiently conventional way that we can just let the Emscripten run-time call main() in its usual way, rather than involving ourselves in the minutiae of Emscripten's startup.
This commit is contained in:
@ -42,7 +42,7 @@ string(JOIN "," emcc_export_string ${emcc_export_list})
|
||||
set(CMAKE_C_LINK_FLAGS "\
|
||||
-s ALLOW_MEMORY_GROWTH=1 \
|
||||
-s EXPORTED_FUNCTIONS='[${emcc_export_string}]' \
|
||||
-s EXTRA_EXPORTED_RUNTIME_METHODS='[cwrap,callMain]' \
|
||||
-s EXTRA_EXPORTED_RUNTIME_METHODS='[cwrap]' \
|
||||
-s STRICT_JS=1")
|
||||
if(WASM)
|
||||
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -s WASM=1")
|
||||
@ -63,7 +63,6 @@ endfunction()
|
||||
function(set_platform_puzzle_target_properties NAME TARGET)
|
||||
em_link_pre_js(${TARGET} ${CMAKE_SOURCE_DIR}/emccpre.js)
|
||||
em_link_js_library(${TARGET} ${CMAKE_SOURCE_DIR}/emcclib.js)
|
||||
em_link_post_js(${TARGET} ${CMAKE_SOURCE_DIR}/emccpost.js)
|
||||
endfunction()
|
||||
|
||||
function(build_platform_extras)
|
||||
|
Reference in New Issue
Block a user