Commit 5151b15c authored by Regis's avatar Regis

comments on turbolinks event handling

parent 696864ea
...@@ -26,10 +26,6 @@ ...@@ -26,10 +26,6 @@
const text = e.target.innerText; const text = e.target.innerText;
const { totalPages, nextPage, previousPage } = this.pageInfo; const { totalPages, nextPage, previousPage } = this.pageInfo;
/**
the regex here is to read if the string coming in will become a valid number
had issues with parsing using `+` because `typeof NaN === 'number'`
*/
if (text === SPREAD) { if (text === SPREAD) {
return; return;
} else if (text === LAST) { } else if (text === LAST) {
......
...@@ -63,12 +63,16 @@ ...@@ -63,12 +63,16 @@
window.removeEventListener('beforeunload', () => {}); window.removeEventListener('beforeunload', () => {});
window.removeEventListener('focus', () => {}); window.removeEventListener('focus', () => {});
window.removeEventListener('blur', () => {}); window.removeEventListener('blur', () => {});
// turbolinks event handler
document.removeEventListener('page:fetch', () => {}); document.removeEventListener('page:fetch', () => {});
}; };
window.addEventListener('beforeunload', removeTimeIntervals); window.addEventListener('beforeunload', removeTimeIntervals);
window.addEventListener('focus', startIntervalLoops); window.addEventListener('focus', startIntervalLoops);
window.addEventListener('blur', removeTimeIntervals); window.addEventListener('blur', removeTimeIntervals);
// turbolinks event handler
document.addEventListener('page:fetch', removeAll); document.addEventListener('page:fetch', removeAll);
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment