New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

actively

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

actively - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "actively",
"version": "1.0.0",
"version": "1.0.1",
"description": "Track user's active time on browser",

@@ -5,0 +5,0 @@ "main": "actively.js",

@@ -1,1 +0,99 @@

# actively
# Actively
> Actively track user engagement and know when they move away from your page.
[![npm version](https://badge.fury.io/js/actively.svg)](https://badge.fury.io/js/actively)
## Install
```
npm install --save actively
```
## Example - basic
```js
import Actively from 'actively';
const active = new Actively({
timeIntervalEllapsedCallbacks: [],
absoluteTimeEllapsedCallbacks: [],
browserTabInactiveCallbacks: [],
browserTabActiveCallbacks: [],
idleTimeoutMs: 3000,
checkCallbacksIntervalMs: 250
})
window.addEventListener('mousemove', active.startTimer)
window.addEventListener('beforeunload', active.stopTimer)
```
## Example - Advanced
```js
import Actively from 'actively';
const active = new Actively({
timeIntervalEllapsedCallbacks: [],
absoluteTimeEllapsedCallbacks: [],
browserTabInactiveCallbacks: [],
browserTabActiveCallbacks: [],
idleTimeoutMs: 3000,
checkCallbacksIntervalMs: 250
})
window.addEventListener('mousemove', active.startTimer)
window.addEventListener('beforeunload', active.stopTimer)
const cb = {
multiplier: time => time + (60 * 5 * 1000), // Every 5 minutes
timeInMilliseconds: 0,
callback: () => {
console.log("Doing Something every 5 minutes")
}
}
active.addTimeIntervalEllapsedCallback(cb)
const callback = () => console.log('Browser going inactive');
active.addBrowserTabInactiveCallback(callback)
var ActiveTimeIntervals = active.times; // array of time periods with user activity
```
## API
### Public methods
#### running <sup>Bool</sup>
Shows is user is active on current webpage and the timer is running.
#### times <sup>Array</sup>
Array of timeDurations when the user was active.
Each time duration is
```js
Object({
start: Date,
stop: Date
})
```
#### idle <sup>Bool</sup>
True when the user is inactive on current webpage and the timer is stopped.
#### currentIdleTimeMs <sup>Integer</sup>
Time elapsed(in miliseconds) since the user was last active.
#### idleTimeoutMs <sup>Integer</sup>
The idle time for a user after which timer stops and user is marked as inactive.
## Public Demo
> Demo coming soon!
[Used in production by Gratia](https://goodwill.zense.co.in/resources/1)
## License
MIT &copy; [Gaurav Koley](https://gaurav.koley.in), 2020
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc