Dialog: add JavaScript bindings