This commit is contained in:
Alexei Anoshenko 2026-07-11 19:21:20 +03:00
parent 9dda89c781
commit 9a4f20f824
4 changed files with 11 additions and 3 deletions

View File

@ -91,9 +91,9 @@ func (storage *clientStorageData) Request(result func(key, value string), key ..
} }
if buffer.Len() == 0 { if buffer.Len() == 0 {
storage.bridge.callFunc("localStorageGetAll", request) storage.bridge.localStorageRequest("localStorageGetAll", request)
} else { } else {
storage.bridge.callFunc("localStorageGet", request, buffer.String()) storage.bridge.localStorageRequest("localStorageGet", request, buffer.String())
} }
} }

View File

@ -14,6 +14,7 @@ type bridge interface {
startUpdateScript(htmlID string) bool startUpdateScript(htmlID string) bool
finishUpdateScript(htmlID string) finishUpdateScript(htmlID string)
callFunc(funcName string, args ...any) bool callFunc(funcName string, args ...any) bool
localStorageRequest(funcName string, args ...any)
updateInnerHTML(htmlID, html string) updateInnerHTML(htmlID, html string)
appendToInnerHTML(htmlID, html string) appendToInnerHTML(htmlID, html string)
updateCSSProperty(htmlID, property, value string) updateCSSProperty(htmlID, property, value string)

View File

@ -53,6 +53,10 @@ func (bridge *wasmBridge) callFunc(funcName string, args ...any) bool {
return true return true
} }
func (bridge *wasmBridge) localStorageRequest(funcName string, args ...any) {
bridge.callFunc(funcName, args...)
}
func (bridge *wasmBridge) updateInnerHTML(htmlID, html string) { func (bridge *wasmBridge) updateInnerHTML(htmlID, html string) {
if ProtocolInDebugLog { if ProtocolInDebugLog {
DebugLog(fmt.Sprintf("%s.innerHTML = '%s'", htmlID, html)) DebugLog(fmt.Sprintf("%s.innerHTML = '%s'", htmlID, html))

View File

@ -35,7 +35,6 @@ type httpBridge struct {
responseBuffer strings.Builder responseBuffer strings.Builder
response chan string response chan string
remoteAddress string remoteAddress string
//conn *websocket.Conn
} }
type canvasVar struct { type canvasVar struct {
@ -237,6 +236,10 @@ func (bridge *webBridge) callFunc(funcName string, args ...any) bool {
return false return false
} }
func (bridge *webBridge) localStorageRequest(funcName string, args ...any) {
bridge.callFuncImmediately(funcName, args...)
}
func (bridge *webBridge) updateInnerHTML(htmlID, html string) { func (bridge *webBridge) updateInnerHTML(htmlID, html string) {
bridge.callFunc("updateInnerHTML", htmlID, html) bridge.callFunc("updateInnerHTML", htmlID, html)
} }