More refactor WIP of moai js host [skip ci]