MCPcopy Create free account
hub / github.com/zxlie/FeHelper / _hit

Function _hit

apps/background/monkey.js:442–458  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

440let _hitTimer = null;
441let _hitBuffer = {};
442const _hit = (id) => {
443 _hitBuffer[id] = (_hitBuffer[id] || 0) + 1;
444 if (_hitTimer) return;
445 _hitTimer = setTimeout(() => {
446 let buf = _hitBuffer; _hitBuffer = {}; _hitTimer = null;
447 chrome.storage.local.get(PAGE_MONKEY_LOCAL_STORAGE_KEY, resps => {
448 let raw = resps && resps[PAGE_MONKEY_LOCAL_STORAGE_KEY];
449 if (!raw) return;
450 try {
451 let arr = JSON.parse(raw);
452 arr.forEach(cm => { if (buf[cm.id]) cm.mHits = (cm.mHits || 0) + buf[cm.id]; });
453 let data = {}; data[PAGE_MONKEY_LOCAL_STORAGE_KEY] = JSON.stringify(arr);
454 chrome.storage.local.set(data);
455 } catch (e) {}
456 });
457 }, 1500);
458};
459
460/* ================== 启动入口(按 runAt 触发) ================== */
461const start = (params) => {

Callers 1

injectMonkeyFunction · 0.85

Calls 4

setTimeoutFunction · 0.85
setMethod · 0.80
getMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected