scrollmonitor-parallax icon indicating copy to clipboard operation
scrollmonitor-parallax copied to clipboard

Test for passive support

Open knynkwl opened this issue 8 years ago • 2 comments
trafficstars

Shouldn't passive support be added to the scroll addEventListener?

var browserSupportsPassive = false;
if (isInBrowser) {
	try {
		var opts = Object.defineProperty({}, 'passive', {
			get: function() {
				browserSupportsPassive = true;
			}
		});
		window.addEventListener('test', null, opts);
	} catch (e) {}
}
const useCapture = browserSupportsPassive ? {capture: false, passive: true} : false;

knynkwl avatar Oct 29 '17 14:10 knynkwl

Yes, a PR adding it would be accepted.

stutrek avatar Oct 29 '17 15:10 stutrek

I'm pretty sure the scroll event is passive by default

jayalfredprufrock avatar Nov 02 '17 23:11 jayalfredprufrock