- Fix a bug with GitHub workflow badge in README. This requires a version bump to resolve on npmjs.com.
- Fix a bug where
disabled
property 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
estrella
withesbuild
and update build chain. - Updated all dependencies.
- Fix types export for latest typescript. #343
The project has switched IDEs from VS Code to WebStorm. The
.vscode
directory has been replaced with.idea
.
- Allow
null
orundefined
as the value for theelement
property to enable easier integration with refs.
- Throw an error when
promptBeforeIdle
is greater than or equal totimeout
. #342
- Expose
IIdleTimer
interface 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
onPrompt
would be emitted instead ofonIdle
aftertimeout
is exceeded when devices wake from sleep. #172 - Fix a bug where
onMessage
was being called with an old function reference. #328
- Add defaults to
IdleTimerComponent
generic 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
isLastActiveTab
method. #294 - Add
getActiveTime
andgetIdleTime
methods. #301 - Add
onPresenceChange
event handler. #319
- Idle state now defaults to false. #304
- Add checks on max timeout values. #316
- Deprecate
promptTimeout
in favor ofpromptBeforeIdle
. #318 - Better typescript docs for
activate
method. #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
onActive
was called on every action whensyncTimers
was 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
componentDidMount
on withIdleTimer higher order component. #276 - Fix regression of memoized
onAction
callbacks. #127 - Fix rounding error on
getRemainingTime()
.
- Fix a bug where workerTimers were not mocked by
createMocks()
. - Fix a bug where
reset
was not resetting the start time affectinggetTotalActiveTime()
. #272
- Add getTabId() method.
- Add activate() method. #263
- Fix a bug where events would leak when
crossTab
is enabled causing bad performance when many tabs are open. #247
- The
reset
method now respectsstartManually
property. It will no longer automatically callonActive
. - Export
DEFAULT_EVENTS
for easy extension of events. #260
- The
getRemainingTime
method now always returns the time to idle instead of time to prompt and then time to idle. #256 - Debounced
onAction
callbacks will automatically be cancelled on idle. #255
- Add
name
property to support multiple instances whencrossTab
is enabled.
- Use builtin
Omit
over 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
leaderElection
is 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 theisLeader
method 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
immediateEvents
property. - Add cross tab custom message broadcasting.
- New higher order component
withIdleTimer
. - New provider
IdleTimerProvider
. - Add
syncTimers
property.
- Timeouts and Intervals are now hoisted into a web worker to bypass browser background throttles.
- Rewrite
crossTab
from 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
getTotalActiveTime
returning negative value. - Fix sending message on closed channel error.
- Remove
capture
property. - Remove
passive
property. - Remove
emitOnAllTabs
property. - Remove
isLeader
method.
- New documentation site.
- Add contribution guide.
- Add issue and pull request templates.
- Updated for React 17.
- Updated all dependencies.
- Make
ref
optional in typedef.
- Export a bundle for modern browsers.
- Add missing
ref
to TypeScript definitions. - Fix a bug where reset would not propagate cross tab.
- Allow for dynamically setting
onActive
andonIdle
event handlers in conjunction with cross tab event reconciliation.
- When
emitOnAllTabs
is set totrue
,start
,reset
,pause
andresume
will be called on all tabs. - Calling
reset
will now automatically fireonActive
while callingstart
will not. Otherwise these two methods are functionally equivalent.
- Fix an issue where the
localStorage
method would not callidle
if there wasn't any user activity on the page. - Fix an issue where the
TabManager
would 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
startManually
configuration option to enable starting of the timer and activity detection manually. An alias toreset()
calledstart()
is also exposed to keep the code more semantic. IfstartManually
is set totrue
, theIdleTimer
component anduseIdleTimer
hook wont start untilreset()
orstart()
are called.
- Fix a bug where throttle and debounce wouldn't work at higher values in useIdleTimer.
- Calling
resume
orpause
from inside auseEffect
will now properly bind and unbind events.
- Setting a timeout dynamically will now call
onActive
if the user is idle.
- Bind
getLastIdleTime
to component scope making the method callable.
- Bind
getTotalActiveTime
andgetTotalIdleTime
to 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
getLastIdleTime
andgetTotalIdleTime
methods.
- Refactor
getTotalActiveTime
to 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
getTotalActiveTime
method. 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
let
andconst
. Re-implement babel to transpile tovar
.
- Fix a regression where
debounce
andthrottle
were not applied toonAction
.
- Fix an issue where callback functions were not being updated. #122
- Fix an issue with TypeScript typings.
- Add TypeScript examples.
- Add
useIdleTimer
hook implementation. - Add
eventsThrottle
to 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
visibilitychange
event to default events. #98
- Fix an issue with mobile devices when the browser is backgrounded with
stopOnIdle
set. #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()
. componentWillMount
is 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:
stopOnIdle
is set totrue
and the user goes idlepause()
is called
Events are bound when:
- component is mounted
reset()
is calledresume()
is called
stopOnIdle
will now keepIdleTimer
in idle state untilreset()
is called.
- Fix a bug where
stopOnIdle
logic was being applied to active state.
- Fix a bug where initial
onIdle
event was not firing whenstopOnIdle
is set
- Add property
stopOnIdle
defaults tofalse
. Setting totrue
will prevent user activity from restarting theIdleTimer
once it has gone idle. This useful if you want to do some custom async stuff before theIdleTimer
gets restarted. In order to restart theIdleTimer
callreset()
on your ref. - Add event handler
onActive
which enables reporting of all user activity fromIdleTimer
. The built indebounce
orthrottle
properties will help increase performance if you are using theonActive
event. By defaultdebounce
andthrottle
are off. Only one can be enabled at a time. - Add property
debounce
defaults to 0. Set theonActive
debounce delay in milliseconds. Thethrottle
property cannot be set if this property is set. - Add property
throttle
defaults to 0. Set theonActive
throttle delay in milliseconds. Thedebounce
property 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
startOnMount
tofalse
starts IdleTimer in the wrong state.
- Fix a bug where setting
startOnMount
tofalse
starts 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
startOnLoad
has been renamed tostartOnMount
to make more sense in a react context. - The property
activeAction
has been renamed toonActive
. - The property
idleAction
has 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
onActive
callback 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.