Changelog
5.7.2#
🐞 Bug Fixes#
- Fix a bug with GitHub workflow badge in README. This requires a version bump to resolve on npmjs.com.
5.7.1#
🐞 Bug Fixes#
- Fix a bug where
disabledproperty would not immediately disable the timer.
5.7.0#
⚡️ Features#
- Added disabled property to enable easier toggling of the timer.
✨ Enhancements#
- Add a legacy bundle to support older browsers.
- Control methods now return a boolean representing the success of the call.
- Update issue templates to use new issue forms.
- Added issue chooser links.
- Replace
estrellawithesbuildand update build chain. - Updated all dependencies.
The project has switched IDEs from VS Code to WebStorm. The
.vscodedirectory has been replaced with.idea.
🐞 Bug Fixes#
- Fix types export for latest typescript. #343
5.6.2#
✨ Enhancements#
- Allow
nullorundefinedas the value for theelementproperty to enable easier integration with refs.
5.6.1#
🐞 Bug Fixes#
- Throw an error when
promptBeforeIdleis greater than or equal totimeout.
5.6.0#
⚡️ Features#
- Expose
IIdleTimerinterface as the second parameter to callback methods.
🐞 Bug Fixes#
- Prevent race condition error from being thrown when the hook unmounts while using leader election.
5.5.3#
🐞 Bug Fixes#
- Fix a bug where
onPromptwould be emitted instead ofonIdleaftertimeoutis exceeded when devices wake from sleep. - Fix a bug where
onMessagewas being called with old function reference.
5.5.2#
✨ Enhancements#
- Add defaults to
IdleTimerComponentgeneric typescript types.
5.5.1#
✨ Enhancements#
- Cross-tab related methods will no longer throw an error if the manager is not ready yet. It will instead return
null.
5.5.0#
⚡️ Features#
- Add isLastActiveTab method.
- Add getActiveTime and getIdleTime methods.
- Add onPresenceChange event handler.
✨ Enhancements#
- Idle state now defaults to false.
- Add checks on max timeout values.
- Deprecate promptTimeout` in favor of promptBeforeIdle.
- Better typescript docs for activate method.
- Improve Higher Order Component and class component support.
🐞 Bug Fixes#
- Use date timestamps everywhere to prevent issues when devices sleep.
- Fix a bug where class components would not preserve this context in IdleTimer methods.
- Fix a bug where onActive was called on every action when syncTimers was set.
- Fix a bug where the mounting of the IdleTimer hook was delayed.
5.4.2#
✨ Enhancements#
- Add a date based sanity check as a backup for the more precise performance timing.
🐞 Bug Fixes#
- Fix
componentDidMounton withIdleTimer higher order component. - Fix regression of memoized
onActioncallbacks. - Fix rounding error on
getRemainingTime().
5.4.1#
🐞 Bug Fixes#
- Fix a bug where workerTimers were not mocked by
createMocks(). - Fix a bug where
resetwas not resetting the start time affectinggetTotalActiveTime().
5.4.0#
⚡️ Features#
- Add getTabId() method.
- Add activate() method.
🐞 Bug Fixes#
- Fix a bug where events would leak when
crossTabis enabled causing bad performance when many tabs are open.
5.3.0#
✨ Enhancements#
- The
resetmethod now respectsstartManuallyproperty. It will no longer automatically callonActive. - Export
DEFAULT_EVENTSfor easy extension of events.
🐞 Bug Fixes#
- The
getRemainingTimemethod now always returns the time to idle instead of time to prompt and then time to idle. - Debounced
onActioncallbacks will automatically be cancelled on idle.
5.2.0#
✨ Enhancements#
- Add
nameproperty to support multiple instances whencrossTabis enabled.
5.1.3#
🐞 Bug Fixes#
- Use builtin
Omitover utility-typesSubtract. Fixes missing dependency error.
5.1.2#
✨ Enhancements#
- Forward ref on
withIdleTimer.
5.1.1#
🐞 Bug Fixes#
- Add missing React import in
withIdleTimer.
5.1.0#
⚡️ Features#
- Add new implementation of Leader Election.
Due to popular request, Leader Election has returned in version 5.1.0. While the old implementation was incompatible with v5, this new implementation is compatible. A new property
leaderElectionis exposed to enable the feature. The major difference between the v4 and v5 implementation is that in v5 events are not isolated to your leader tab automatically. You will need to call theisLeadermethod inside your event handlers. See the docs for more information.
5.0.0#
Version 5 is a complete, from scratch, typescript rewrite. A lot of effort went into this release. If you find this package useful and have the means, please consider a small donation!
⚡️ Features#
- Add built in prompt handling.
- Add
immediateEventsproperty. - Add cross tab custom message broadcasting.
- New higher order component
withIdleTimer. - New provider
IdleTimerProvider. - Add
syncTimersproperty.
✨ Enhancements#
- Timeouts and Intervals are now hoisted into a web worker to bypass browser background throttles.
- Rewrite
crossTabfrom the ground up. The new implementation is much smaller and more efficient. - Cross Tab options simplified.
- All callbacks and methods are now memoized.
🐞 Bug Fixes#
- All property values can now be dynamically updated.
- Fix
getTotalActiveTimereturning negative value. - Fix sending message on closed channel error.
🔥 Code Removal#
- Remove
captureproperty. - Remove
passiveproperty. - Remove
emitOnAllTabsproperty. - Remove
isLeadermethod.
📝 Documentation#
- New documentation site.
- Add contribution guide.
- Add issue and pull request templates.
⬆️ Update Dependencies#
- Updated for React 17.
- Updated all dependencies.
4.6.4#
🐞 Bug Fixes#
- Make
refoptional in typedef.
4.6.3#
✨ Enhancements#
- Export a bundle for modern browsers.
🐞 Bug Fixes#
- Add missing
refto TypeScript definitions. - Fix a bug where reset would not propagate cross tab.
4.6.2#
✨ Enhancements#
- Allow for dynamically setting
onActiveandonIdleevent handlers in conjunction with cross tab event reconciliation.
4.6.1#
✨ Enhancements#
- When
emitOnAllTabsis set totrue,start,reset,pauseandresumewill be called on all tabs. - Calling
resetwill now automatically fireonActivewhile callingstartwill not. Otherwise these two methods are functionally equivalent.
🐞 Bug Fixes#
- Fix an issue where the
localStoragemethod would not callidleif there wasn't any user activity on the page. - Fix an issue where the
TabManagerwould not deregister itself when the tab was closed if it was not the leader tab.
🚿 Clean up#
- Fix a type-o in propTypes, typescript definitions and docs.
4.6.0#
⚡️ Features#
- Add cross tab support. See examples and README for usage and documentation.
- Add an
isLeader()method that returns a boolean indicating whether or not the current tab is the lead orchestrator for cross tab reconciliation. - Add a
startManuallyconfiguration option to enable starting of the timer and activity detection manually. An alias toreset()calledstart()is also exposed to keep the code more semantic. IfstartManuallyis set totrue, theIdleTimercomponent anduseIdleTimerhook wont start untilreset()orstart()are called.
🐞 Bug Fixes#
- Fix a bug where throttle and debounce wouldn't work at higher values in useIdleTimer.
4.5.6#
🐞 Bug Fixes#
- Calling
resumeorpausefrom inside auseEffectwill now properly bind and unbind events.
4.5.5#
✨ Enhancements#
- Setting a timeout dynamically will now call
onActiveif the user is idle.
4.5.4#
✨ Enhancements#
- Bind
getLastIdleTimeto component scope making the method callable.
4.5.3#
✨ Enhancements#
- Bind
getTotalActiveTimeandgetTotalIdleTimeto component scope making the methods callable.
4.5.2#
✨ Enhancements#
- Add the ability to set timeout after the component has been mounted. Doing so will reset the timer automatically.
4.5.1#
✨ Enhancements#
- Add the ability to set timeout after the hook has been mounted. Doing so will reset the timer automatically.
4.5.0#
⚡️ Features#
- Add
getLastIdleTimeandgetTotalIdleTimemethods.
✨ Enhancements#
- Refactor
getTotalActiveTimeto be accurate in more scenarios.
💚 CI#
- Switch from travis to github actions.
4.4.2#
⬆️ Update Dependencies#
- Update peerDependencies to support React versions greater than 16.
4.4.1#
⏱ Performance#
- Reduce bundle size by excluding examples from npm package.
📝 Documentation#
- Update README.md.
4.4.0#
⚡️ Features#
- Add
getTotalActiveTimemethod. Returns the total time in milliseconds the user was active.
4.3.7#
✨ Enhancements#
- Add more event types to typescript definition
📝 Documentation#
- Fix a type-o in the default events (mouseWheel -> mousewheel)
4.3.6#
📝 Documentation#
- Fix a type-o in the README examples.
4.3.5#
🐞 Bug Fixes#
- Fix a regression affecting older minifiers that don't know how to deal with
letandconst. Re-implement babel to transpile tovar.
4.3.4#
🐞 Bug Fixes#
- Fix a regression where
debounceandthrottlewere not applied toonAction.
4.3.2#
🐞 Bug Fixes#
- Fix an issue where callback functions were not being updated. #122
4.3.1#
🐞 Bug Fixes#
- Fix an issue with TypeScript typings.
📝 Documentation#
- Add TypeScript examples.
4.3.0#
⚡️ Features#
- Add
useIdleTimerhook implementation. - Add
eventsThrottleto reduce cpu using on events that can spam the event handler. Defaults to 200ms.
⬆️ Update Dependencies#
- Update all dependencies, added new examples and cleaned up build chain.
4.2.12#
✨ Enhancements#
- Add
visibilitychangeevent to default events. #98
4.2.11#
🐞 Bug Fixes#
- Fix an issue with mobile devices when the browser is backgrounded with
stopOnIdleset. #96
4.2.10#
🐞 Bug Fixes#
- Fix a bug where onIdle was not triggered consistently on iOS. #94
- Refactor of toggleIdle function to prevent race conditions. #93
4.2.9#
🐞 Bug Fixes#
- Fix a bug where HMR systems would prevent events from unbinding. #87
4.2.8#
🐞 Bug Fixes#
- Fix a bug where a paused timer would return the wrong remaining time when resumed.
4.2.7#
🐞 Bug Fixes#
- Fixes a regression introduced in v4.2.6 affecting
getRemainingTime().
4.2.6#
🐞 Bug Fixes#
- Fix a bug where
reset()was not resettinggetRemainingTime(). componentWillMountis deprecated. Moved logic tocomponentDidMount.
⬆️ Update Dependencies#
- Update dependencies
4.2.5#
🔥 Code Removal#
- Remove ref from typedef as it's included in the React Component interface. #76
4.2.4#
🐞 Bug Fixes#
- Fix typescript definition for event methods.
- Fix a bug where throttled and debounced actions would not take new props.
4.2.3#
🐞 Bug Fixes#
- Fix an issue importing module with typescript. #72
4.2.2#
🐞 Bug Fixes#
- Fix an issue updating state from inside onIdle. #71
4.2.1#
✨ Enhancements#
- Add a typescript definition that will now be maintained along with this library. It expects that you have the react type definitions installed.
📝 Documentation#
- Fix a documentation error.
4.2.0#
⚡️ Features#
- Dynamically bind and unbind events.
Events are unbound when:
stopOnIdleis set totrueand the user goes idlepause()is called
Events are bound when:
- component is mounted
reset()is calledresume()is called
4.1.3#
🐞 Bug Fixes#
stopOnIdlewill now keepIdleTimerin idle state untilreset()is called.
4.1.2#
🐞 Bug Fixes#
- Fix a bug where
stopOnIdlelogic was being applied to active state.
4.1.1#
🐞 Bug Fixes#
- Fix a bug where initial
onIdleevent was not firing whenstopOnIdleis set
4.1.0#
⚡️ Features#
- Add property
stopOnIdledefaults tofalse. Setting totruewill prevent user activity from restarting theIdleTimeronce it has gone idle. This useful if you want to do some custom async stuff before theIdleTimergets restarted. In order to restart theIdleTimercallreset()on your ref. - Add event handler
onActivewhich enables reporting of all user activity fromIdleTimer. The built indebounceorthrottleproperties will help increase performance if you are using theonActiveevent. By defaultdebounceandthrottleare off. Only one can be enabled at a time. - Add property
debouncedefaults to 0. Set theonActivedebounce delay in milliseconds. Thethrottleproperty cannot be set if this property is set. - Add property
throttledefaults to 0. Set theonActivethrottle delay in milliseconds. Thedebounceproperty cannot be set if this property is set.
4.0.9#
🐞 Bug Fixes#
- Fix a memory leak when IdleTimer is unmounted.
4.0.8#
🐞 Bug Fixes#
- Fix a bug where passive and capture were not being passed to the event listener.
4.0.7#
🐞 Bug Fixes#
- Fix some inconsistencies in the README.
📝 Documentation#
- Add default prop values to documentation.
4.0.6#
🐞 Bug Fixes#
- Fix a bug where setting
startOnMounttofalsestarts IdleTimer in the wrong state.
4.0.5#
🐞 Bug Fixes#
- Fix a bug where setting
startOnMounttofalsestarts IdleTimer in the wrong state.
4.0.4#
🐞 Bug Fixes#
- Fix a bug where the module could not be imported.
4.0.3#
📝 Documentation#
- Minor documentation updates.
💚 CI#
- Continuous integration bugfixes.
4.0.2#
📝 Documentation#
- Minor documentation updates
💚 CI#
- Continuous integration bugfixes
4.0.1#
📝 Documentation#
- Minor documentation updates
💚 CI#
- Continuous integration bugfixes
4.0.0#
Version 4.0 contains a rewrite of the build system and a refactor of the source code for IdleTimer. After accepting many pull requests, the projects code style was destroyed, so some forced styling was added and PRs that don't respect this style will not be accepted. Contribution guide now on the README.
🔥 Code Removal#
- The property
startOnLoadhas been renamed tostartOnMountto make more sense in a react context. - The property
activeActionhas been renamed toonActive. - The property
idleActionhas been renamed toonIdle.
✨ Enhancements#
- Add passive property. Defaults to
true, bind events with passive mode enabled. - Add capture property. Defaults to
true, bind events with capture mode enabled. - Pass event through to
onActivecallback functions.
🐞 Bug Fixes#
- Fixed installation bug on windows machines. This was due to the use of environment variables in the build scripts. The new build system does not rely on environment variables defined at the cli level
3.0.0#
Dropped support for date formatting in version 3. IdleTimer returns raw date objects and you can use which ever library you like to format it. If you would like to continue using the built in formatter, stick with version 2.
🔥 Breaking Changes#
- Removed built in date formatter.
2.0.0#
⚡️ Features#
- Add support for server side rendering.
1.0.0#
🚀 Genesis#
Initial release.