Add emit function to the JavaScript VM