add a version of emscripten_set_main_loop where the main loop takes an argument; fixes #2114