Ouch, just realized that the JS API is sync, so nevermind.