adding examples

This commit is contained in:
Tommy D. Rossi
2025-11-13 19:42:44 +01:00
parent ac5322e580
commit ec02a90812
57 changed files with 8226 additions and 0 deletions
@@ -0,0 +1,21 @@
// Import helper functions from background-commands
import { respondWith, respondWithError } from './background-commands.js';
export async function getLogs(tabState, { before, limit = 100, level }) {
try {
// Get the logs from the tab state using its built-in method
const logs = tabState.getConsoleLogs(limit, level, before);
// Check if there are more logs available
const totalFilteredCount = tabState.getConsoleLogs(null, level, before).length;
const hasMore = totalFilteredCount > limit;
return respondWith(tabState.tabId, {
logs: logs,
hasMore: hasMore,
totalCount: tabState.getConsoleLogCount()
});
} catch (error) {
return respondWithError(tabState.tabId, 'CONSOLE_LOG_ERROR', error.message);
}
}