MCPcopy
hub / github.com/CopyTranslator/CopyTranslator / track

Method track

src/main/tracker.ts:51–60  ·  view source on GitHub ↗

* 核心追踪接口 * @param type 事件类型,如 'translation', 'launch', 'heartbeat' * @param key 细分标识,如 'deepseek', 'startup'

(type: string, key: string = 'default')

Source from the content-addressed store, hash-verified

49 * @param key 细分标识,如 'deepseek', 'startup'
50 */
51 public track(type: string, key: string = 'default'): void {
52 const compositeKey = `${type}|${key}`;
53 const currentCount = this.buffer.get(compositeKey) || 0;
54 this.buffer.set(compositeKey, currentCount + 1);
55
56 // 如果缓冲区条目过多,立即触发同步
57 if (this.buffer.size >= this.threshold) {
58 this.flush();
59 }
60 }
61
62 /**
63 * 手动或自动触发同步

Callers 2

translateSentenceMethod · 0.80
translateWithMethod · 0.80

Calls 3

flushMethod · 0.95
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected