Terminal emulator in Javascript