Documentation ¶
Overview ¶
Package web implements system interfaces on the web through WASM
Index ¶
- Variables
- func AddEventListener(v js.Value, nm string, fn func(this js.Value, args []js.Value) any, ...)
- func Init()
- func UserAgentToOS(ua string) system.Platforms
- type App
- func (a *App) AddEventListeners()
- func (a *App) Clipboard(win system.Window) system.Clipboard
- func (a *App) Cursor(win system.Window) system.Cursor
- func (a *App) DataDir() string
- func (a *App) EventPos(e js.Value) image.Point
- func (a *App) EventPosFor(x, y js.Value) image.Point
- func (a *App) HideVirtualKeyboard()
- func (a *App) InitDrawer()
- func (a *App) IsDark() bool
- func (a *App) NewWindow(opts *system.NewWindowOptions) (system.Window, error)
- func (a *App) OnBeforeInput(this js.Value, args []js.Value) any
- func (a *App) OnBlur(this js.Value, args []js.Value) any
- func (a *App) OnContextMenu(this js.Value, args []js.Value) any
- func (a *App) OnKeyDown(this js.Value, args []js.Value) any
- func (a *App) OnKeyUp(this js.Value, args []js.Value) any
- func (a *App) OnMouseDown(this js.Value, args []js.Value) any
- func (a *App) OnMouseMove(this js.Value, args []js.Value) any
- func (a *App) OnMouseUp(this js.Value, args []js.Value) any
- func (a *App) OnResize(this js.Value, args []js.Value) any
- func (a *App) OnTouchEnd(this js.Value, args []js.Value) any
- func (a *App) OnTouchMove(this js.Value, args []js.Value) any
- func (a *App) OnTouchStart(this js.Value, args []js.Value) any
- func (a *App) OnWheel(this js.Value, args []js.Value) any
- func (a *App) OpenURL(url string)
- func (a *App) Platform() system.Platforms
- func (a *App) Resize()
- func (a *App) RuneAndCodeFromKey(k string, down bool) (rune, key.Codes)
- func (a *App) SetSystemWindow()
- func (a *App) ShouldProcessKey(k string) bool
- func (a *App) ShowVirtualKeyboard(typ styles.VirtualKeyboards)
- func (a *App) SystemInfo() string
- func (a *App) SystemPlatform() system.Platforms
- type Clipboard
- type Cursor
- type Drawer
- func (dw *Drawer) AsGPUDrawer() *gpudraw.Drawer
- func (dw *Drawer) Copy(dp image.Point, src image.Image, sr image.Rectangle, op draw.Op, ...)
- func (dw *Drawer) DestBounds() image.Rectangle
- func (dw *Drawer) End()
- func (dw *Drawer) Renderer() any
- func (dw *Drawer) Scale(dr image.Rectangle, src image.Image, sr image.Rectangle, rotateDeg float32, ...)
- func (dw *Drawer) Start()
- func (dw *Drawer) Transform(xform math32.Matrix3, src image.Image, sr image.Rectangle, op draw.Op, ...)
- type Window
Constants ¶
This section is empty.
Variables ¶
var TheApp = &App{AppSingle: base.NewAppSingle[*Drawer, *Window]()}
TheApp is the single system.App for the web platform
var TheClipboard = &Clipboard{}
TheClipboard is the single system.Clipboard for the web platform
var TheCursor = &Cursor{CursorBase: system.CursorBase{Vis: true, Size: 32}}
TheCursor is the single system.Cursor for the web platform
Functions ¶
func AddEventListener ¶
func UserAgentToOS ¶
UserAgentToOS converts the given user agent string to a system.Platforms value.
Types ¶
type App ¶
type App struct { base.AppSingle[*Drawer, *Window] // UnderlyingPlatform is the underlying system platform (Android, iOS, etc) UnderlyingPlatform system.Platforms // KeyMods are the current key mods KeyMods key.Modifiers }
App is the system.App implementation for the web platform
func (*App) AddEventListeners ¶
func (a *App) AddEventListeners()
func (*App) EventPos ¶
EventPos returns the appropriate position for the given event, multiplying the x and y components by the device pixel ratio so that they line up correctly with the canvas.
func (*App) EventPosFor ¶
EventPosFor transforms the given position by multiplying the x and y components by the device pixel ratio so that they line up correctly with the canvas.
func (*App) HideVirtualKeyboard ¶
func (a *App) HideVirtualKeyboard()
func (*App) InitDrawer ¶ added in v0.3.2
func (a *App) InitDrawer()
InitDrawer sets the Drawer to a WebGPU-based drawer if the browser supports WebGPU and a backup 2D image drawer otherwise.
func (*App) NewWindow ¶
NewWindow creates a new window with the given options. It waits for the underlying system window to be created first. Also, it hides all other windows and shows the new one.
func (*App) Resize ¶
func (a *App) Resize()
Resize updates the app sizing information and sends a Resize event.
func (*App) RuneAndCodeFromKey ¶
RuneAndCodeFromKey returns the rune and key code corresponding to the given key string. down is whether this is from a keyDown event (as opposed to a keyUp one)
func (*App) SetSystemWindow ¶
func (a *App) SetSystemWindow()
SetSystemWindow sets the underlying system window information.
func (*App) ShouldProcessKey ¶ added in v0.1.1
ShouldProcessKey returns whether the given key string should be processed by Cogent Core.
func (*App) ShowVirtualKeyboard ¶
func (a *App) ShowVirtualKeyboard(typ styles.VirtualKeyboards)
func (*App) SystemInfo ¶ added in v0.2.0
func (*App) SystemPlatform ¶
type Clipboard ¶
type Clipboard struct {
system.ClipboardBase
}
Clipboard is the system.Clipboard implementation for the web platform
type Cursor ¶
type Cursor struct {
system.CursorBase
}
Cursor is the system.Cursor implementation for the web platform
type Drawer ¶
type Drawer struct {
// contains filtered or unexported fields
}
Drawer implements system.Drawer with a WebGPU-based drawer if available and a backup 2D image drawer if not.
func (*Drawer) AsGPUDrawer ¶ added in v0.3.2
AsGPUDrawer implements gpudraw.AsGPUDrawer.
func (*Drawer) DestBounds ¶
func (*Drawer) End ¶ added in v0.3.2
func (dw *Drawer) End()
End ends image drawing rendering process on render target. This is the thing that actually does the drawing for the web backup 2D image drawer.
type Window ¶
type Window struct { base.WindowSingle[*App] }
Window is the implementation of system.Window for the web platform.
func (*Window) SetGeometry ¶ added in v0.3.6
Directories ¶
Path | Synopsis |
---|---|
Package jsfs provides a Node.js style filesystem API in Go that can be used to allow os functions to work on wasm.
|
Package jsfs provides a Node.js style filesystem API in Go that can be used to allow os functions to work on wasm. |