Add startAppIdleTimeout, stopAppIdleTimeout, and resetAppIdleTimeout methods to mixin #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds
startAppIdleTimeout
,stopAppIdleTimeout
, andresetAppIdleTimeout
methods to the mixin.startAppIdleTimeout
internally calls thestart
method on theIdleJs
instance.stopAppIdleTimeout
internally calls thestop
method on theIdleJs
instance.resetAppIdleTimeout
internally calls theresetTimeout
method on theIdleJs
instance.The
start
,stop
, andresetTimeout
methods on theIdleJs
instance were added on newer idlejs versions, so I had to upgrade the dependency as well.startAppIdleTimeout
andstopAppIdleTimeout
Allow to start and stop the idle timeout under certain conditions, for example, toggling it when toggling fullscreen:
resetAppIdleTimeout
Allows, for example, the following use case (but not limited to): consider an app embedded in iframes, you can display an idle overlay (with
pointer-events:none
) that allows the users to keep scrolling the host page until they type/click/tap into the app in the iframe. Then once the app becomes active (overlay disappears), you also register an event listener to themousemove
event and fire a function to reset the timeout and keep the app active.Notice not including
mousemove
on lib install, so the app will not become active while moving the mouse and until the user types/clicks/taps.Then when the app becomes active, we add an event listener for the
mousemove
event to call a method that will reset the timeout to keep the app active: