As a general point, if you wrap some JS code in a function, *nothing* will
be executed until you execute the function. Having pre and post js look
like "function abc() {" and "}" accomplishes this.On 22 April 2015 at 20:13, Danilo Guanabara Fernandes <[email protected]> wrote: > I read somewhere that the main function is executed in the exact moment > that the runtime is loaded and ready. But anyway... > > The only thing that I need is to start Emscripten's execution, for > example, when some UI event occurs. > I am not sure if your solution will accomplish that, it seems that it only > affects the execution order. > > 2015-04-22 14:49 GMT-03:00 Aidan Hobson Sayers <[email protected]>: > >> What do you mean by 'when the runtime was loaded'? >> >> I use --pre-js and --post-js to have fine-grained control over running >> order. >> For example, take a look at >> https://github.com/aidanhs/emtcl/blob/master/js/preJs.js and >> https://github.com/aidanhs/emtcl/blob/master/js/postJsTcl.js >> >> You could modify this by putting the stuff in post-js inside a function >> itself which you could insert into window as 'initemtcl' or something >> similar. >> Honestly, I'm not sure if those two links are the best way to do this >> kind of thing any more. I created this structure of pre/post-js about a >> year and a half ago and I've just copied and pasted since then. For >> example, I don't know if emscripten still pollutes `window.Module`. >> >> Hopefully it gives you a starting point - basically just wrap everything >> in a function and run that when you want to kick off. >> >> Aidan >> >> On 22 April 2015 at 16:13, Danilo Guanabara <[email protected]> wrote: >> >>> Is there any way to run the code exactly when I want it to run and not >>> just when the runtime was loaded? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "emscripten-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "emscripten-discuss" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/emscripten-discuss/9Ej-JPYjRSw/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
