Added new functions and updated doc/javascriptAPI.txt