Is it possible to listen to events dispatched by in-page objects? Let's say I have this code in the page I go to:
var event = new CustomEvent('status', { detail: 'ok' });
window.addEventListener('status', function(e) {
console.log('status: ', e.detail);
});
setInterval(window.dispatchEvent, 1000, event);
I'd like to be able to listen to events dispatched by the window object (or any other JS object for that matter). How can I do this in Puppeteer?