moribvndvs / ng2-idle

Responding to idle users in Angular (not AngularJS) applications.
https://moribvndvs.github.io/ng2-idle
Apache License 2.0
322 stars 129 forks source link

INTERRUPTS Changing #164

Closed hossameh closed 10 months ago

hossameh commented 2 years ago

NOTE: Due to limited time constraints and resources, we ask that you please use Stack Overflow or similar to troubleshoot or ask general questions, and not use bug reports to solicit help setting up your app.

Describe the bug How to chang the default interrupts and put my own.

To Reproduce .

Expected behavior

Please tell us about your environment

Additional context

majomanoj commented 2 years ago

you can pass in an instance of DocumentInterruptSource class with required Interrupts as an array to setInterrupts method.

idle.setInterrupts( [ new DocumentInterruptSource( "keydown wheel scroll click" ) ]);

moitgoyal commented 12 months ago
    const customInterrupts = [
        new WindowInterruptSource('focus'),
        ...DEFAULT_INTERRUPTSOURCES,
        new DocumentInterruptSource('visibilitychange'),
    ];

    // Set the custom interrupt sources
    this.idle.setInterrupts(customInterrupts);