Javascript Wait For Async Function