Make wait a promise and a helper
Merge pull request #2576 from teddyzeenny/wait

Make wait a promise and a helper