Javascript Wait For Result Of Async Function