Updates the structure of all function calls

The JS file changed significantly since the last commit, so I’ve
updated the documentation - not long now until an official API release
I think!