Files
sonr/internal/dwn/middleware/browser.go
T

36 lines
656 B
Go
Raw Normal View History

2024-09-16 01:06:00 -04:00
//go:build js && wasm
// +build js,wasm
2024-09-18 02:22:17 -04:00
package middleware
2024-09-16 01:06:00 -04:00
import (
"github.com/donseba/go-htmx"
"github.com/labstack/echo/v4"
2024-09-18 02:22:17 -04:00
"github.com/onsonr/sonr/internal/dwn/middleware/jsexc"
2024-09-16 01:06:00 -04:00
)
type Browser struct {
echo.Context
isMobile bool
userAgent string
width int
olc string
ksuid string
// HTMX Specific
htmx *htmx.HTMX
// WebAPIs
2024-09-18 02:22:17 -04:00
indexedDB jsexc.IndexedDBAPI
localStorage jsexc.LocalStorageAPI
push jsexc.PushAPI
sessionStorage jsexc.SessionStorageAPI
}
func UseNavigator(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
cc := jsexc.NewNavigator(c)
return next(cc)
}
2024-09-16 01:06:00 -04:00
}