emscripten gets pretty close via webassembly, you can embed all your assets... but it takes awhile to load before anything's happening when done that way.
You can still do that with wasm by splitting the code. You need to loop through js to connect them, but for things like levels, you can likely do that or just memcpy between those environments.