Skip to content

Instantly share code, notes, and snippets.

@aereal
Created Aug 3, 2018
Embed
What would you like to do?
(() => {
const submitBtn = document.querySelector('input[type=submit]');
let startedAt;
const flash = (ts) => {
if (!startedAt) startedAt = ts;
const elapsed = ts - startedAt;
if (elapsed > 100) {
const e = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true,
})
submitBtn.dispatchEvent(e);
startedAt = undefined;
}
window.requestAnimationFrame(flash);
};
window.requestAnimationFrame(flash);
})();