add chan_* functions to the js api.
fixes for the jsonchan functionality.