Javascript Wait For Async In Sync Method