Closed bygrace1986 closed 6 years ago
Implemented in a5e24eb. However, this has to be manually enabled by your application, and should do so based on whether or not you detect the browser supports this feature (since not all will).
I did not want to build feature detection into this module as it is out of scope, but instead leave that up to you. However, I've added a function that you can use in concert with the feature detection of your choice so you can still utilize default interrupt sources. More info here.
Simply change to the following (this example uses detectIt):
const idle = new Idle();
idle.setInterrupts(createDefaultInterruptSources({passive: detectIt.passiveEvents});
idle.watch();
I'm submitting a ... (check one with "x")
Current behavior Adding default list of event listeners (DEFAULT_INTERRUPTSOURCES) causes warnings in Angular4. EX: [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive.
Expected behavior Add event listeners in passive mode.
Minimal reproduction of the problem with instructions const idle = new Idle(); idle.setInterrupts(DEFAULT_INTERRUPTSOURCES); idle.watch();
What is the motivation / use case for changing the behavior? Improved performance.
@ng-idle version: 2.0.0-beta.12
Angular version: 4.2.2
Browser: Chrome 51+
Language: all
Node: v6.10.3