Yeah... Well, I'm pretty sure you're wrong:
'use strict';
function getNextEvent() {
return new Promise(resolve => {
document.getElementById('button').onclick = event => resolve(event);
})
}
async function enterEventLoop() {
let event = null;
while (event = await getNextEvent()) {
alert(event);
}
}
enterEventLoop();
And thanks for recommending RxJS, but I've been using reactive programming on various platforms for the past 6 years, so I'm pretty sure it already had "clicked" for me.