{"id":22425246,"url":"https://github.com/fireworkweb/inactivejs","last_synced_at":"2025-06-15T06:33:50.191Z","repository":{"id":31190542,"uuid":"127171386","full_name":"fireworkweb/inactivejs","owner":"fireworkweb","description":"Detect when a user is idle. No dependencies, small footprint (5.47kb).","archived":false,"fork":false,"pushed_at":"2022-12-08T18:51:20.000Z","size":1234,"stargazers_count":3,"open_issues_count":18,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-05-26T17:57:23.902Z","etag":null,"topics":["idle","inactive","javascript","timer","user"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fireworkweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-28T16:54:43.000Z","updated_at":"2020-03-16T12:37:37.000Z","dependencies_parsed_at":"2023-01-14T18:45:15.052Z","dependency_job_id":null,"html_url":"https://github.com/fireworkweb/inactivejs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fireworkweb/inactivejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fireworkweb%2Finactivejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fireworkweb%2Finactivejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fireworkweb%2Finactivejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fireworkweb%2Finactivejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fireworkweb","download_url":"https://codeload.github.com/fireworkweb/inactivejs/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fireworkweb%2Finactivejs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259934772,"owners_count":22934330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["idle","inactive","javascript","timer","user"],"created_at":"2024-12-05T19:13:36.840Z","updated_at":"2025-06-15T06:33:50.170Z","avatar_url":"https://github.com/fireworkweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# inactivejs\n\n[![Build Status](https://travis-ci.org/fireworkweb/inactivejs.svg?branch=develop)](https://travis-ci.org/fireworkweb/inactivejs)\n\nDetect when a user is idle or when he change tabs/apps. Small footprint package (5.47kb). Inspired by [Idle.js](https://github.com/shawnmclean/Idle.js)\n\n## Usage\n\nInstall with npm/yarn:\n\n```sh\nnpm install inactivejs\n\nyarn add inactivejs\n```\n\nImport on your js file:\n\n```js\nconst InactiveJS = require('inactivejs');\n\nimport InactiveJS from 'inactivejs';\n```\n\nInstantiate:\n\n```js\nconst onAway = () =\u003e {\n    console.log('user is away');\n};\n\nconst onBack = () =\u003e {\n    console.log('user is back');\n};\n\nconst inactiveInstance = new InactiveJS({\n    timeout: 5000,\n    onAway: onAway,\n    onBack: onBack,\n});\n```\n\nConfig options:\n\n- **timeout** (ms): how much time should wait\n- **onAway** (callback): callback to be executed when the user is away\n- **onBack** (callback): callback to be executed when the user is back\n- **onVisible** (callback): callback to be executed when the tab is visible\n- **onHidden** (callback): callback to be executed when the tab is hidden\n- **events** (array): events to listen for\n- **autoStart** (boolean): if start timer automatically\n- **throttle** (ms): ms to throttle the event listeners, undefined/false to disable it\n\nAvailable methods:\n\n- **start()**: if you configured autoStart to false, this method will start the timer\n- **stop()**: if needed, this will stop the timer\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffireworkweb%2Finactivejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffireworkweb%2Finactivejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffireworkweb%2Finactivejs/lists"}