Skip to content

Commit

Permalink
feat: update constructor & code example
Browse files Browse the repository at this point in the history
  • Loading branch information
dmythro committed Jan 10, 2022
1 parent 5a3c4d8 commit d8d86c0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ npm install idle-detect

```ts
import IdleDetect from 'idle-detect'
// Or, if you don't want to use still experimental IdleDetector API:
// import { IdleDetect } from 'idle-detect/dist/IdleDetect'

const onInactive = () => {
console.info('User is inactive now')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "idle-detect",
"version": "0.1.0",
"version": "0.1.1",
"description": "A TypeScript library for inactivity timer, which utilises `IdleDetector` API where possible or a fallback to `window.setTimeout` approach",
"main": "dist/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/IdleDetectIsomorph.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IdleDetect, defaultEventTypes, defaultNoop } from './IdleDetect'
import { IdleDetect, defaultEventTypes, defaultIdleTime, defaultNoop } from './IdleDetect'

export const isIdleDetectorSupported = () => 'IdleDetector' in window

Expand All @@ -9,7 +9,7 @@ export class IdleDetectIsomorph extends IdleDetect {

constructor(
/** Number of seconds for idle detection, 15 minutes by default */
idleSeconds: number,
idleSeconds: number = defaultIdleTime,
/** Event handler when user is idle for specified time */
onIdle: () => void = defaultNoop,
enableLogs = false,
Expand Down

0 comments on commit d8d86c0

Please sign in to comment.