Skip to content

Instantly share code, notes, and snippets.

@Inontran
Created August 13, 2020 03:11
Show Gist options
  • Select an option

  • Save Inontran/68579eb2cc348d27a14009fcaa260854 to your computer and use it in GitHub Desktop.

Select an option

Save Inontran/68579eb2cc348d27a14009fcaa260854 to your computer and use it in GitHub Desktop.
проверка на поддержку passive
var passiveSupported = false;
try {
window.addEventListener(
"test",
null,
Object.defineProperty({}, "passive", { get: function() { passiveSupported = true; } }));
// console.log('passiveSupported == ' + passiveSupported);
} catch(err) {}
document.addEventListener('scroll', function(){
},
passiveSupported ? { passive: true } : false
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment