Skip to content

Instantly share code, notes, and snippets.

View yastrebovb's full-sized avatar
📲
Building

Boris Yastrebov yastrebovb

📲
Building
  • Russia, Moscow
View GitHub Profile
@yastrebovb
yastrebovb / passive.js
Created September 16, 2019 09:23
Passive event listeners for lighthouse "Best Practices"
(function() {
var supportsPassive = eventListenerOptionsSupported();
if (supportsPassive) {
var addEvent = EventTarget.prototype.addEventListener;
overwriteAddEvent(addEvent);
}
function overwriteAddEvent(superMethod) {
var defaultOptions = {