I’m not sure there is any documentation on it at all. None I am aware of.
The best bet it to take an example that does something you want to emulate and right click on the description and choose view source.
You can also copy or edit an existing one, look for the script icon, double click on it, and then it will show you the embedded JavaScript.
Related: Using HTML and JavaScript