MCPcopy Create free account
hub / github.com/massCodeIO/massCode / useCopyTracker

Function useCopyTracker

src/renderer/composables/useCopyTracker.ts:9–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7let lastCopyAt = 0
8
9export function useCopyTracker() {
10 if (listenerAttached) {
11 return
12 }
13
14 const { incrementCopy } = useDonations()
15
16 function onCopy() {
17 const now = Date.now()
18 if (now - lastCopyAt < DEDUP_MS) {
19 return
20 }
21 lastCopyAt = now
22
23 const space = getActiveSpaceId()
24 if (!space) {
25 return
26 }
27
28 incrementCopy(space)
29 }
30
31 document.addEventListener('copy', onCopy)
32 listenerAttached = true
33}

Callers

nothing calls this directly

Calls 1

useDonationsFunction · 0.90

Tested by

no test coverage detected