Files
rrweb/rrweb-simple-ext/background.js
zhaoyilun 27a17d7068
Some checks failed
Tests / Tests (push) Has been cancelled
ESLint Check / ESLint Check and Report Upload (push) Has been cancelled
Prettier Check / Format Check (push) Has been cancelled
Prettier Check / Format Code (push) Has been cancelled
ESLint Check / Build Base for Bundle Size Comparison (push) Has been cancelled
Add SuperRPA integration guide, simple extension and standalone replay page
- docs/integration/superrpa-integration.zh_CN.md: complete integration guide
- rrweb-simple-ext/: minimal Chrome extension for page recording
- replay.html: standalone drag-and-drop replay viewer
- CLAUDE.md: project instructions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 17:08:24 +08:00

26 lines
855 B
JavaScript

// background.js - service worker
const events = [];
let recording = false;
let activeTabId = null;
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
if (msg.action === 'startRecording') {
events.length = 0;
recording = true;
activeTabId = msg.tabId;
chrome.tabs.sendMessage(msg.tabId, { action: 'startRecord' });
sendResponse({ ok: true });
} else if (msg.action === 'stopRecording') {
recording = false;
chrome.tabs.sendMessage(activeTabId, { action: 'stopRecord' });
sendResponse({ ok: true, eventCount: events.length });
} else if (msg.action === 'getEvents') {
sendResponse({ events: events });
} else if (msg.action === 'event') {
events.push(msg.data);
} else if (msg.action === 'getStatus') {
sendResponse({ recording, eventCount: events.length });
}
return true;
});