mirror of
https://github.com/cupcakearmy/ora.git
synced 2026-04-02 20:15:25 +00:00
dismiss & use svelte in client
This commit is contained in:
19
src/client/reporter.js
Normal file
19
src/client/reporter.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import browser from 'webextension-polyfill'
|
||||
|
||||
let lastReported = 0
|
||||
|
||||
function logActivity() {
|
||||
const now = Date.now()
|
||||
// Limit reports to once every second
|
||||
if (now - lastReported < 1000) return
|
||||
lastReported = now
|
||||
browser.runtime.sendMessage({
|
||||
type: 'report',
|
||||
})
|
||||
}
|
||||
|
||||
export function init() {
|
||||
window.document.addEventListener('mousemove', logActivity, false)
|
||||
window.document.addEventListener('keydown', logActivity, false)
|
||||
window.document.addEventListener('scroll', logActivity, false)
|
||||
}
|
||||
Reference in New Issue
Block a user