Added callbacks to javascript api