atlassian / Browser Interaction Time
Licence: mit
⏰ A JavaScript library (written in TypeScript) to measure the time a user is active on a website
Stars: ✭ 175
Programming Languages
typescript
32286 projects
Projects that are alternatives of or similar to Browser Interaction Time
Browser Metrics
A collection of metrics tools for measuring performance ⚡️
Stars: ✭ 115 (-34.29%)
Mutual labels: performance, browser
about-time
A cool helper for tracking time and throughput of code blocks, with beautiful human friendly renditions.
Stars: ✭ 36 (-79.43%)
Mutual labels: tracking, time
Scriptsafe
a browser extension to bring security and privacy to chrome, firefox, and opera
Stars: ✭ 434 (+148%)
Mutual labels: tracking, browser
Zeit
Zeit, erfassen. A command line tool for tracking time spent on activities.
Stars: ✭ 33 (-81.14%)
Mutual labels: time, tracking
Timewarrior
Timewarrior - Commandline Time Reporting
Stars: ✭ 528 (+201.71%)
Mutual labels: time, tracking
Gitlab Time Tracker
🦊🕘 A command line interface for GitLab's time tracking feature.
Stars: ✭ 371 (+112%)
Mutual labels: time, tracking
Perf Monitor
Performance monitor. Simple UI component that helps you measure performance.
Stars: ✭ 115 (-34.29%)
Mutual labels: performance, browser
Browser Hack Sass Mixins
Browser hack sass mixin - Apply your SCSS to a specific browser - CSS hacks for: IE, Chrome, Firefox, Edge, Opera
Stars: ✭ 170 (-2.86%)
Mutual labels: browser
Fe Performance Journey
🚵 a Journey of Performance Optimizing in Frontend 🚀
Stars: ✭ 169 (-3.43%)
Mutual labels: performance
Binding
Simple API implement DataBinding and ViewBinding. 简单的 API 实现 DataBinding 和 ViewBinding,欢迎 star
Stars: ✭ 169 (-3.43%)
Mutual labels: activity
Fugit
time tools (cron, parsing, durations, ...) for Ruby, rufus-scheduler, and flor
Stars: ✭ 172 (-1.71%)
Mutual labels: time
Eztime
ezTime — pronounced "Easy Time" — is a very easy to use Arduino time and date library that provides NTP network time lookups, extensive timezone support, formatted time and date strings, user events, millisecond precision and more.
Stars: ✭ 173 (-1.14%)
Mutual labels: time
React Native Performance Monitor
React Native Performance Monitor - Realtime graphing of React Native render performance
Stars: ✭ 174 (-0.57%)
Mutual labels: performance
browser-interaction-time
BrowserInteractionTime lets you track the time a user is active on your webpage while ignoring time spent on a different tab or with a minimized window. It also ignores the time spent while the user is idle on a web page meaning after a certain amount of time (idleTimeoutMs) without any user interactions (scroll, mousemovement etc) the time will stop until the next user interaction.
Importing BrowserInteractionTime
You can import the generated bundle to use the whole library like this:
import BrowserInteractionTime from 'browser-interaction-time'
Additionally, you can import the transpiled modules from dist/lib
:
import BrowserInteractionTime from 'browser-interaction-time/dist/lib/'
API
Initialize
import BrowserInteractionTime from 'browser-interaction-time'
const browserInteractionTime = new BrowserInteractiontime({
timeIntervalEllapsedCallbacks: [],
absoluteTimeEllapsedCallbacks: [],
browserTabInactiveCallbacks: [],
browserTabActiveCallbacks: [],
idleTimeoutMs: 3000,
checkCallbacksIntervalMs: 250
})
Start timer
browserInteractionTime.startTimer()
Stop timer
browserInteractionTime.stopTimer()
Adding a callback that is executed on interval
const cb = {
multiplier: time => time * 2,
timeInMilliseconds: 1000,
callback: () => console.log('callback')
}
browserInteractionTime.addTimeIntervalEllapsedCallback(cb)
Adding a callback that is executed on absolute time
const callbackData = {
timeInMilliseconds: 1000,
callback: () => console.log('callback')
pending: true
}
browserInteractionTime.addAbsoluteTimeEllapsedCallback(callbackData)
Adding callback executed when browser tab becomes inactive
const callback = () => console.log('some callback')
browserInteractionTime.addBrowserTabInactiveCallback(callback)
Adding callback executed when browser tab becomes active
const callback = () => console.log('some callback')
browserInteractionTime.addBrowserTabActiveCallback(callback)
https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark)
Set a mark on modified timeline (seebrowserInteractionTime.mark('a-mark')
browserInteractionTime.mark('b-mark')
https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark)
Get marks by name (seebrowserInteractionTime.getMarks('a-mark')
https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure)
Set measure time between 2 marks (seebrowserInteractionTime.measure('a-measure', 'a-mark', 'b-mark')
Get measure by name
browserInteractionTime.getMeasures('a-measure') // Array of measures with name
Get Time in Milliseconds
browserInteractionTime.getTimeInMilliseconds() // number
Check if timer is running
browserInteractionTime.isRunning() // boolean
Reset all times
browserInteractionTime.reset()
Cleanup event listeners and timers
browserInteractionTime.destroy()
NPM scripts
-
npm t
: Run test suite -
npm start
: Runnpm run build
in watch mode -
npm run test:watch
: Run test suite in interactive watch mode -
npm run test:prod
: Run linting and generate coverage -
npm run build
: Generate bundles and typings, create docs -
npm run lint
: Lints code -
npm run commit
: Commit using conventional commit style (husky will tell you to use it if you haven't 😉)
Author
Maximilian Heinz @meandmax
Collaborators
❤️ Logo Design by Dominik Straka
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].