In general there is no need to write code in mind for compiling with Emscripten. The codebase just needs to be reasonably portable C++ or C. For example, if the codebase runs on both x86 desktop and ARM Android, then it will almost certainly run properly using Emscripten.
For APIs, you also need to use something portable and standard, like SDL for example.
For APIs, you also need to use something portable and standard, like SDL for example.