var bt = {
[Symbol.asyncIterator]: () => {
const items = 'for-await-of'.split('')
return {
next: () => {
return new Promise(resolve => {
setTimeout(() => {
resolve({
done: items.length === 0,
value: items.shift()
})
}, 1000)
})
}
}
}
};
(async function(){
for await (const item of bt) {
console.log(item)
}
})()