kripken/emscripten — pull request #1937 by inolen (2013-12-20 19:26:52+00:00)
Title: added new AUTORUN setting

* added new AUTORUN setting to enable completely disabling emscripten's default startup sequence
* preInit was moved inside of run so that it wasn't called at all when using AUTORUN=0
* exported preInit, preRun, etc. functions to enable users to completely customize the startup sequence
* deprecate INVOKE_RUN

The general idea here is that we're now exporting all of the functions used by run, such that if run is disabled, the user can fine-tune the startup sequence to their liking. Or, if they'd just like to delay calling run, they can always AUTORUN=0 and call run manually. This closes https://github.com/kripken/emscripten/issues/1562.

The only nasty side to this change is that we export Module['preRun'] as the preRun function, yet that's also used to specify the initial preRun tasks. However, I don't think this actually presents a problem for any current use case. I've ran `browser` and `default` tests on this change.

Finally, I'm curious to know if it's possible to deprecate preInit and preMain as well to simplify the startup. preInit isn't used by emscripten internally and preMain is used for a very minor FS feature that we could work around.