Add support for emscripten platform

now with the complete changes.