ext.mx raw
1 //:build !wasm
2
3 package ext
4
5 // Browser extension API stubs (browser.storage.local, browser.runtime).
6 // Moxie JS backend replaces these with calls to ext.mjs.
7
8 // StorageGet retrieves a value from browser.storage.local.
9 func StorageGet(key string, fn func(string)) { panic("jsbridge") }
10
11 // StorageSet stores a key-value pair in browser.storage.local.
12 func StorageSet(key, value string) { panic("jsbridge") }
13
14 // StorageRemove removes a key from browser.storage.local.
15 func StorageRemove(key string) { panic("jsbridge") }
16
17 // OnMessage registers a handler for browser.runtime.onMessage.
18 // fn receives (method, paramsJSON, senderTabID, respond).
19 // respond must be called exactly once with the response JSON string.
20 func OnMessage(fn func(string, string, int32, func(string))) { panic("jsbridge") }
21
22 // SendMessageToTab sends a message to a specific tab's content script.
23 func SendMessageToTab(tabID int32, msg string) { panic("jsbridge") }
24
25 // GetActiveTab gets the active tab's ID and URL.
26 func GetActiveTab(fn func(int32, string)) { panic("jsbridge") }
27
28 // ConsoleLog logs a message to the browser console (extension background).
29 func ConsoleLog(msg string) { panic("jsbridge") }
30
31 // SessionGet retrieves a value from sessionStorage (in-page mode only).
32 func SessionGet(key string, fn func(string)) { panic("jsbridge") }
33
34 // SessionSet stores a key-value pair in sessionStorage (in-page mode only).
35 func SessionSet(key, value string) { panic("jsbridge") }
36
37 // IsInPage returns true when running as in-page signer (not extension).
38 func IsInPage() (ok bool) { panic("jsbridge") }
39
40 // SignalReady tells the host that async boot work (vault load) finished.
41 func SignalReady() { panic("jsbridge") }
42