MCPcopy Create free account
hub / github.com/crittermike/shortkeys / executeScript

Function executeScript

src/utils/execute-script.ts:2–12  ·  view source on GitHub ↗
(callback: (...args: any[]) => T, args?: any[])

Source from the content-addressed store, hash-verified

1/** Execute a script in the active tab. */
2export async function executeScript<T>(callback: (...args: any[]) => T, args?: any[]): Promise<any> {
3 const [tab] = await browser.tabs.query({ currentWindow: true, active: true })
4 if (!tab?.id) {
5 throw new Error('No active tab found')
6 }
7 return browser.scripting.executeScript({
8 target: { tabId: tab.id },
9 func: callback,
10 args,
11 })
12}
13
14/** Show a brief toast notification in the active tab. */
15export async function showPageToast(message: string): Promise<void> {

Callers 5

getBodyScrollHeightFunction · 0.90
captureScreenshotFunction · 0.90
copyToClipboardFunction · 0.90
action-handlers.tsFile · 0.90
showPageToastFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected