I was at a meetup yesterday where Axel Rauschmayer explained what's new in ES6, and especially the use of generators and yield was to me a mindblowing new way of programming.
Yours is a nice example of using yield to turn asynchronous code synchronous.