{"_id":"activity-detector","_rev":"9-26da42d6caed23bc65b33d98706ad6e3","name":"activity-detector","description":"Detects when a user is really using your page and when he is idle","dist-tags":{"latest":"3.0.0"},"versions":{"1.0.0":{"name":"activity-detector","version":"1.0.0","description":"Detects when a user is really using your page and when he is idle","main":"dist/activity-detector.js","scripts":{"test":"npm run lint && ./node_modules/.bin/tape -r babel-register 'tests/**/*.js' | ./node_modules/.bin/faucet","lint":"eslint src/ tests/","build":"babel -d dist/ src/","clean":"rm -r node_modules dist","prepublish":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/tuenti/activity-detector.git"},"keywords":["user","activity","away","idle","active"],"author":{"name":"atabel87@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/tuenti/activity-detector/issues"},"homepage":"https://github.com/tuenti/activity-detector#readme","devDependencies":{"babel-cli":"^6.5.1","babel-preset-es2015":"^6.5.0","babel-register":"^6.5.2","eslint":"^2.2.0","faucet":"0.0.1","jsdom":"^8.0.4","sinon":"^1.17.3","tape":"^4.4.0"},"gitHead":"03d85ba8111b2b2ac38fede1c3c8879837e25e25","_id":"activity-detector@1.0.0","_shasum":"de338f6a2b99f532f0a0d6cb2a98d09c478aa609","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.6.0","_npmUser":{"name":"atabel","email":"atabel87@gmail.com"},"dist":{"shasum":"de338f6a2b99f532f0a0d6cb2a98d09c478aa609","tarball":"https://registry.npmjs.org/activity-detector/-/activity-detector-1.0.0.tgz","integrity":"sha512-F96h1ARtmbjdz1+90uHnxSsohJXMPeiEEMPAQKqc04XVqLu6ogHJmmFtwLBVLHzbo/bzPlJ7zVl117q9JPyXWA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwFlWhbDXiprE7Zr0b0zN/jHN6JSVOgTTDyiOOcPm04wIgRtrPthKlkHh37qz3JnTplLFfZbgy0UmWL5U+5YVZcrM="}]},"maintainers":[{"name":"atabel","email":"atabel87@gmail.com"}],"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/activity-detector-1.0.0.tgz_1455966961787_0.5082808556035161"},"directories":{}},"1.1.0":{"name":"activity-detector","version":"1.1.0","description":"Detects when a user is really using your page and when he is idle","main":"dist/activity-detector.js","scripts":{"test":"npm run lint && ./node_modules/.bin/tape -r babel-register 'tests/**/*.js' | ./node_modules/.bin/faucet","lint":"eslint src/ tests/","build":"babel -d dist/ src/","build:umd":"webpack -p src/activity-detector.js dist/activity-detector.min.js","clean":"rm -r node_modules dist","prepublish":"npm run build; npm run build:umd"},"repository":{"type":"git","url":"git+https://github.com/tuenti/activity-detector.git"},"keywords":["user","activity","away","idle","active"],"author":{"name":"atabel87@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/tuenti/activity-detector/issues"},"homepage":"https://github.com/tuenti/activity-detector#readme","devDependencies":{"babel-cli":"^6.5.1","babel-loader":"^6.2.4","babel-plugin-add-module-exports":"^0.1.2","babel-preset-es2015":"^6.5.0","babel-register":"^6.5.2","eslint":"^2.2.0","faucet":"0.0.1","jsdom":"^8.0.4","sinon":"^1.17.3","tape":"^4.4.0","webpack":"^1.12.14"},"gitHead":"c3def3c01cf8c010d489e41b439c7035f729d8dc","_id":"activity-detector@1.1.0","_shasum":"10e9b7bc28c7b69dc4b472be07fbe8690fd40e08","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.6.0","_npmUser":{"name":"atabel","email":"atabel87@gmail.com"},"dist":{"shasum":"10e9b7bc28c7b69dc4b472be07fbe8690fd40e08","tarball":"https://registry.npmjs.org/activity-detector/-/activity-detector-1.1.0.tgz","integrity":"sha512-TixWRyLA4/GNDpd8qtzGeQgqor204MU/A6V1vA6mBG5TAwHeVoN7aHfM+VbNKl6tgBPccY6kVMFH6l2DlttXLg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE7z2V7SI9p6Ex8Pz34/ptRpgfcd5BUbDOmGf0RuiIe5AiEA1Cpy278/vQCjhk0zyjNcCFlNNy8xEmGVwhoy3h6KSKg="}]},"maintainers":[{"name":"atabel","email":"atabel87@gmail.com"}],"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/activity-detector-1.1.0.tgz_1456593483931_0.2340705341193825"},"directories":{}},"1.1.1":{"name":"activity-detector","version":"1.1.1","description":"Detects when a user is really using your page and when he is idle","main":"dist/activity-detector.js","scripts":{"test":"npm run lint && ./node_modules/.bin/tape -r babel-register 'tests/**/*.js' | ./node_modules/.bin/faucet","lint":"eslint src/ tests/","build":"babel -d dist/ src/","build:umd":"webpack -p src/activity-detector.js dist/activity-detector.min.js","clean":"rm -r node_modules dist","prepublish":"npm run build; npm run build:umd"},"repository":{"type":"git","url":"git+https://github.com/tuenti/activity-detector.git"},"keywords":["user","activity","away","idle","active"],"author":{"name":"atabel87@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/tuenti/activity-detector/issues"},"homepage":"https://github.com/tuenti/activity-detector#readme","devDependencies":{"babel-cli":"^6.5.1","babel-loader":"^6.2.4","babel-plugin-add-module-exports":"^0.1.2","babel-preset-es2015":"^6.5.0","babel-register":"^6.5.2","eslint":"^2.2.0","faucet":"0.0.1","jsdom":"^8.0.4","sinon":"^1.17.3","tape":"^4.4.0","webpack":"^1.12.14"},"gitHead":"884054ebd676d8d79c72b6e7cdb8ca234d392977","_id":"activity-detector@1.1.1","_shasum":"33f4eb1d9ef880b69504b4eecbd7c20d2d790338","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.6.0","_npmUser":{"name":"atabel","email":"atabel87@gmail.com"},"dist":{"shasum":"33f4eb1d9ef880b69504b4eecbd7c20d2d790338","tarball":"https://registry.npmjs.org/activity-detector/-/activity-detector-1.1.1.tgz","integrity":"sha512-UsZeTBDJ/uQFbVxyBWInikdq11LvjNwj/esorXar2WMTMPjGygqNNmm1RKmWUr1qp/gYmVdwnsn42w0WPIysig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDh8PeCQ6wckucIYWYhsGHzm6qwNoIyGGg3RChekavaWAIhAK7mom7JJ4DZi/Whf9G3J1KtChkzqb3kWBMSc1ujQxev"}]},"maintainers":[{"name":"atabel","email":"atabel87@gmail.com"}],"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/activity-detector-1.1.1.tgz_1456593762569_0.47081430116668344"},"directories":{}},"2.0.0":{"name":"activity-detector","version":"2.0.0","description":"Detects when a user is really using your page and when he is idle","main":"dist/activity-detector.js","scripts":{"test":"tape -r babel-register 'tests/**/*.js' | faucet","lint":"eslint src/ tests/","build":"babel -d dist/ src/","build:umd":"webpack -p src/activity-detector.js dist/activity-detector.min.js","clean":"rimraf dist","prepublish":"npm run lint && npm test && npm run clean && npm run build && npm run build:umd"},"repository":{"type":"git","url":"git+https://github.com/tuenti/activity-detector.git"},"keywords":["user","activity","away","idle","active"],"author":{"name":"atabel87@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/tuenti/activity-detector/issues"},"homepage":"https://github.com/tuenti/activity-detector#readme","devDependencies":{"babel-cli":"^6.5.1","babel-loader":"^6.2.4","babel-plugin-add-module-exports":"^0.1.2","babel-preset-es2015":"^6.5.0","babel-register":"^6.5.2","eslint":"^2.2.0","faucet":"0.0.1","jsdom":"8.0.4","rimraf":"^2.5.4","sinon":"^1.17.3","tape":"^4.4.0","webpack":"^1.12.14"},"gitHead":"aa6e4aa8dbbdfb0fc1830f00769cc0e4d2d8ed26","_id":"activity-detector@2.0.0","_shasum":"48f15c42dabfc8fea8e8e06bb1813ec026254326","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.2.1","_npmUser":{"name":"atabel","email":"atabel87@gmail.com"},"dist":{"shasum":"48f15c42dabfc8fea8e8e06bb1813ec026254326","tarball":"https://registry.npmjs.org/activity-detector/-/activity-detector-2.0.0.tgz","integrity":"sha512-he44SQMQJEDc8ouELgOCIjF5HFDSPY7iFN4aixRthSF+QpxSCjGXIPwLM+Z6RRmyEP+htyvayWZp340BblTh3w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBnH3D4kBsAgETMXCAyDfzP6rf50oLrkwL+0aV1hkxdAAiB9dYjipowM/nXEs9L1ozRsvI9CLotSLIzegF6siyzbhg=="}]},"maintainers":[{"name":"atabel","email":"atabel87@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/activity-detector-2.0.0.tgz_1476979467125_0.9925822173245251"},"directories":{}},"2.1.0":{"name":"activity-detector","version":"2.1.0","description":"Detects when a user is really using your page and when he is idle","main":"dist/activity-detector.js","scripts":{"test":"tape -r babel-register 'tests/**/*.js' | faucet","lint":"eslint src/ tests/","build":"babel -d dist/ src/","build:umd":"webpack -p src/activity-detector.js dist/activity-detector.min.js","clean":"rimraf dist","prepublish":"npm run lint && npm test && npm run clean && npm run build && npm run build:umd"},"repository":{"type":"git","url":"git+https://github.com/tuenti/activity-detector.git"},"keywords":["user","activity","away","idle","active"],"author":{"name":"atabel87@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/tuenti/activity-detector/issues"},"homepage":"https://github.com/tuenti/activity-detector#readme","devDependencies":{"babel-cli":"^6.5.1","babel-loader":"^6.2.4","babel-plugin-add-module-exports":"^0.1.2","babel-preset-es2015":"^6.5.0","babel-register":"^6.5.2","eslint":"^2.2.0","faucet":"0.0.1","jsdom":"8.0.4","rimraf":"^2.5.4","sinon":"^1.17.3","tape":"^4.4.0","webpack":"^1.12.14"},"gitHead":"5dc3f8f820684ecc136dc92524d81ec637628d2b","_id":"activity-detector@2.1.0","_shasum":"5aed9a9a96f8677978b3f820fe3390abb3587f02","_from":".","_npmVersion":"4.3.0","_nodeVersion":"6.2.1","_npmUser":{"name":"atabel","email":"atabel87@gmail.com"},"dist":{"shasum":"5aed9a9a96f8677978b3f820fe3390abb3587f02","tarball":"https://registry.npmjs.org/activity-detector/-/activity-detector-2.1.0.tgz","integrity":"sha512-+BEHyylfNBZuImG4YnlZoUWWCStMszNS7yc3O0bod6L/1DBVMtO2fU1SAqmjPMzvHGGEsD6fknKmReQ5rX3nBw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDizgujbD2IH0cevL00V+Knl6hUomktJvScGoVcKvZqWAIgQ/LOX1wlqjVBP/vhEPwr7kEDZO6boSGrRJU3HnUHG0g="}]},"maintainers":[{"name":"atabel","email":"atabel87@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/activity-detector-2.1.0.tgz_1494587474978_0.21518907067365944"},"directories":{}},"3.0.0":{"name":"activity-detector","version":"3.0.0","description":"Detects when a user is really using your page and when he is idle","main":"dist/activity-detector.js","scripts":{"test":"tape -r babel-register tests/**/*.js | faucet","lint":"eslint src/ tests/","build":"babel -d dist/ src/","build:umd":"webpack -p src/activity-detector.js dist/activity-detector.min.js","clean":"rimraf dist","prepublishonly":"npm run lint && npm test && npm run clean && npm run build && npm run build:umd"},"repository":{"type":"git","url":"git+https://github.com/tuenti/activity-detector.git"},"keywords":["user","activity","away","idle","active"],"author":{"name":"atabel87@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/tuenti/activity-detector/issues"},"homepage":"https://github.com/tuenti/activity-detector#readme","devDependencies":{"babel-cli":"^6.5.1","babel-loader":"^6.2.4","babel-plugin-add-module-exports":"^0.1.2","babel-preset-es2015":"^6.5.0","babel-register":"^6.5.2","eslint":"^2.2.0","faucet":"0.0.1","jsdom":"8.0.4","rimraf":"^2.5.4","sinon":"^1.17.3","tape":"^4.4.0","webpack":"^1.12.14"},"gitHead":"0593fa51621b63ac1ed5f2b44cd7d28670496609","_id":"activity-detector@3.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"atabel","email":"atabel87@gmail.com"},"dist":{"integrity":"sha512-N1fl3FEAjh8jZcYZQHVOsziWFk3U6xXHIUPATTOChYvlTBJbnW9Y5A2PlVAxJFQKLqZRLS5G/hP5qh9oXQktdw==","shasum":"e46696d137c5946b9b1e22c26f4671c630d7616b","tarball":"https://registry.npmjs.org/activity-detector/-/activity-detector-3.0.0.tgz","fileCount":10,"unpackedSize":21688,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCeT2/SAyS5eNvvn/vc3ryHF5uNXcntz1IoagqfigQ00QIhAK0EvJMjfSzXoovLkde+R4zW1A0/FnNX6YdHpc0suVXF"}]},"maintainers":[{"name":"atabel","email":"atabel87@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/activity-detector_3.0.0_1518194379914_0.3195887407935365"},"_hasShrinkwrap":false}},"readme":"# activity-detector\n\n[![npm](https://img.shields.io/npm/v/activity-detector.svg)](https://www.npmjs.com/package/activity-detector)\n[![npm](https://img.shields.io/npm/l/activity-detector.svg)](https://www.npmjs.com/package/activity-detector)\n[![Build Status](https://travis-ci.org/tuenti/activity-detector.svg)](https://travis-ci.org/tuenti/activity-detector)\n\nThis module helps you detecting when the user becomes idle (does not interact with the page for some time) or active in your page.\n\n## Install\n```\n$ npm install --save activity-detector\n```\n\nOr load it from unpkg:\n```html\n<script src=\"https://unpkg.com/activity-detector/dist/activity-detector.min.js\"></script>\n```\n\n## How to use\n\n### Basic example\n\n```javascript\nimport createActivityDetector from 'activity-detector';\n\nconst activityDetector = createActivityDetector();\n\nactivityDetector.on('idle', () => {\n\tconsole.log('The user is not interacting with the page');\n});\n\nactivityDetector.on('active', () => {\n\tconsole.log('The user is using the page');\n});\n```\n\n### Advanced options\n\nActivity detector allows you to configure some parameters:\n- `timeToIdle`: number of milliseconds of inactivity which makes activity detector transition to 'idle' (`30000` by default)\n- `activityEvents`: the user events which make activity detector transition from 'idle' to 'active'. The default list of activityEvents is `['click', 'mousemove', 'keydown', 'DOMMouseScroll', 'mousewheel', 'mousedown', 'touchstart', 'touchmove', 'focus']`\n- `inactivityEvents`: the list of events which make the activity detector transition from 'active' to 'idle' without waiting for `timeToIdle` timeout. By default: `['blur']`\n- `ignoredEventsWhenIdle`: list of events to ignore in idle state. By default: `['mousemove']`\n- `initialState`: can be `\"idle\"` or `\"active\"` (`\"active\"` by default)\n- `autoInit`: when `true` the activity detector starts just after creation, when `false`, it doesn't start until you call the `.init()` method (`true` by default)\n\nFor example:\n```javascript\nconst activityDetector = createActivityDetector({\n\ttimeToIdle: 20000, // wait 20s of inactivity to consider the user is idle\n\tautoInit: false // I don't want to start the activity detector yet.\n});\n\nactivityDetector.on('idle', handleUserIdle);\n\n...\n...\n\n// I want to start the activity detector now!\nactivityDetector.init();\n\n```\n\n### Instance methods\n\nAn activity detector instance has the following methods:\n\n#### `start(initialState = 'active')`\n\nInitializes the activity detector in the given state. This method should only be used if you created the activity detector with the `autoInit` option `false`.\n\nThis method receives the `initialState` param. It can be `'idle'` or `'active'` (default)\n\n#### `on(event, handler)`\n\nRegisters an event listener for the required event\n\n`event` can be `'idle'` or `'active'`.\n\n`handler` must be a function.\n\n#### `stop()`\n\nStops the activity detector and cleans the listeners.\n\n## Development\n\n### Run tests\n\n```\n$ npm install\n$ npm test\n```\n","maintainers":[{"name":"atabel","email":"atabel87@gmail.com"}],"time":{"modified":"2022-06-13T02:24:04.215Z","created":"2016-02-20T11:16:04.798Z","1.0.0":"2016-02-20T11:16:04.798Z","1.1.0":"2016-02-27T17:18:05.232Z","1.1.1":"2016-02-27T17:22:45.418Z","2.0.0":"2016-10-20T16:04:29.202Z","2.1.0":"2017-05-12T11:11:16.353Z","3.0.0":"2018-02-09T16:39:40.581Z"},"homepage":"https://github.com/tuenti/activity-detector#readme","keywords":["user","activity","away","idle","active"],"repository":{"type":"git","url":"git+https://github.com/tuenti/activity-detector.git"},"author":{"name":"atabel87@gmail.com"},"bugs":{"url":"https://github.com/tuenti/activity-detector/issues"},"license":"MIT","readmeFilename":"README.md"}