Multi-threaded javascript environment