- Fix a bug with GitHub workflow badge in README. This requires a version bump to resolve on npmjs.com.
- Fix a bug where
disabledproperty would not immediately disable the timer.
- Added disabled property to enable easier toggling of the timer. #349
- Add a legacy bundle to support older browsers. #345.
- 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.
- Fix types export for latest typescript. #343
The project has switched IDEs from VS Code to WebStorm. The
.vscodedirectory has been replaced with.idea.
- Allow
nullorundefinedas the value for theelementproperty to enable easier integration with refs.
- Throw an error when
promptBeforeIdleis greater than or equal totimeout. #342
- Expose
IIdleTimerinterface as the second parameter to callback methods. #339
- Prevent race condition error from being thrown when the hook unmounts while using leader election. #337
- Fix a bug where
onPromptwould be emitted instead ofonIdleaftertimeoutis exceeded when devices wake from sleep. #172 - Fix a bug where
onMessagewas being called with an old function reference. #328
- Add defaults to
IdleTimerComponentgeneric typescript types.
- Cross-tab related methods will no longer throw an error if the manager is not ready yet. It will instead return
null.
- Add
isLastActiveTabmethod. #294 - Add
getActiveTimeandgetIdleTimemethods. #301 - Add
onPresenceChangeevent handler. #319
- Idle state now defaults to false. #304
- Add checks on max timeout values. #316
- Deprecate
promptTimeoutin favor ofpromptBeforeIdle. #318 - Better typescript docs for
activatemethod. #319 - Improve Higher Order Component and class component support.
- Use date timestamps everywhere to prevent issues when devices sleep. #281
- Fix a bug where class components would not preserve this context in IdleTimer methods. #309
- Fix a bug where
onActivewas called on every action whensyncTimerswas set. #320 - Fix a bug where the mounting of the IdleTimer hook was delayed.
- Add a clock based sanity check as a backup for the more precise performance timing. #281
- Fix
componentDidMounton withIdleTimer higher order component. #276 - Fix regression of memoized
onActioncallbacks. #127 - Fix rounding error on
getRemainingTime().
- Fix a bug where workerTimers were not mocked by
createMocks(). - Fix a bug where
resetwas not resetting the start time affectinggetTotalActiveTime(). #272
- Add getTabId() method.
- Add activate() method. #263
- Fix a bug where events would leak when
crossTabis enabled causing bad performance when many tabs are open. #247
- The
resetmethod now respectsstartManuallyproperty. It will no longer automatically callonActive. - Export
DEFAULT_EVENTSfor easy extension of events. #260
- The
getRemainingTimemethod now always returns the time to idle instead of time to prompt and then time to idle. #256 - Debounced
onActioncallbacks will automatically be cancelled on idle. #255
- Add
nameproperty to support multiple instances whencrossTabis enabled.
- Use builtin
Omitover utility-typesSubtract. Fixes missing dependency error.
- Forward ref on
withIdleTimer.
- Add missing React import in
withIdleTimer.
- 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.
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!
- Add built in prompt handling.
- Add
immediateEventsproperty. - Add cross tab custom message broadcasting.
- New higher order component
withIdleTimer. - New provider
IdleTimerProvider. - Add
syncTimersproperty.
- 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.
- All property values can now be dynamically updated.
- Fix
getTotalActiveTimereturning negative value. - Fix sending message on closed channel error.
- Remove
captureproperty. - Remove
passiveproperty. - Remove
emitOnAllTabsproperty. - Remove
isLeadermethod.
- New documentation site.
- Add contribution guide.
- Add issue and pull request templates.
- Updated for React 17.
- Updated all dependencies.
- Make
refoptional in typedef.
- Export a bundle for modern browsers.
- Add missing
refto TypeScript definitions. - Fix a bug where reset would not propagate cross tab.
- Allow for dynamically setting
onActiveandonIdleevent handlers in conjunction with cross tab event reconciliation.
- 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.
- 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.
- Fix a type-o in propTypes, typescript definitions and docs.
- 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.
- Fix a bug where throttle and debounce wouldn't work at higher values in useIdleTimer.
- Calling
resumeorpausefrom inside auseEffectwill now properly bind and unbind events.
- Setting a timeout dynamically will now call
onActiveif the user is idle.
- Bind
getLastIdleTimeto component scope making the method callable.
- Bind
getTotalActiveTimeandgetTotalIdleTimeto component scope making the methods callable.
- Add the ability to set timeout after the component has been mounted. Doing so will reset the timer automatically.
- Add the ability to set timeout after the hook has been mounted. Doing so will reset the timer automatically.
- Add
getLastIdleTimeandgetTotalIdleTimemethods.
- Refactor
getTotalActiveTimeto be accurate in more scenarios.
- Switch from travis to github actions.
- Update peerDependencies to support React versions greater than 16.
- Reduce bundle size by excluding examples from npm package.
- Update README.md.
- Add
getTotalActiveTimemethod. Returns the total time in milliseconds the user was active.
- Add more event types to typescript definition
- Fix a type-o in the default events (mouseWheel -> mousewheel)
- Fix a type-o in the README examples.
- Fix a regression affecting older minifiers that don't know how to deal with
letandconst. Re-implement babel to transpile tovar.
- Fix a regression where
debounceandthrottlewere not applied toonAction.
- Fix an issue where callback functions were not being updated. #122
- Fix an issue with TypeScript typings.
- Add TypeScript examples.
- Add
useIdleTimerhook implementation. - Add
eventsThrottleto reduce cpu using on events that can spam the event handler. Defaults to 200ms.
- Update all dependencies, added new examples and cleaned up build chain.
- Add
visibilitychangeevent to default events. #98
- Fix an issue with mobile devices when the browser is backgrounded with
stopOnIdleset. #96
- Fix a bug where onIdle was not triggered consistently on iOS. #94
- Refactor of toggleIdle function to prevent race conditions. #93
- Fix a bug where HMR systems would prevent events from unbinding. #87
- Fix a bug where a paused timer would return the wrong remaining time when resumed.
- Fixes a regression introduced in v4.2.6 affecting
getRemainingTime().
- Fix a bug where
reset()was not resettinggetRemainingTime(). componentWillMountis deprecated. Moved logic tocomponentDidMount.
- Update dependencies
- Remove ref from typedef as it's included in the React Component interface. #76
- Fix typescript definition for event methods.
- Fix a bug where throttled and debounced actions would not take new props.
- Fix an issue importing module with typescript. #72
- Fix an issue updating state from inside onIdle. #71
- Add a typescript definition that will now be maintained along with this library. It expects that you have the react type definitions installed.
- Fix a documentation error.
- 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
stopOnIdlewill now keepIdleTimerin idle state untilreset()is called.
- Fix a bug where
stopOnIdlelogic was being applied to active state.
- Fix a bug where initial
onIdleevent was not firing whenstopOnIdleis set
- 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.
- Fix a memory leak when IdleTimer is unmounted.
- Fix a bug where passive and capture were not being passed to the event listener.
- Fix some inconsistencies in the README.
- Add default prop values to documentation.
- Fix a bug where setting
startOnMounttofalsestarts IdleTimer in the wrong state.
- Fix a bug where setting
startOnMounttofalsestarts IdleTimer in the wrong state.
- Fix a bug where the module could not be imported.
- Minor documentation updates.
- Continuous integration bugfixes.
- Minor documentation updates
- Continuous integration bugfixes
- Minor documentation updates
- Continuous integration bugfixes
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.
- 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.
- 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.
- 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
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.
- Removed built in date formatter.
- Add support for server side rendering.
Initial release.