Documentation
¶
Overview ¶
Package platform shows elements only on some platforms:
giode.OnlyOn(giode.PlatformWindows, func() giode.Element { return windowsTitleBar() })
The platform is fixed when the app is built (Current is a constant), so OnlyOn costs one comparison, and the builders for other platforms are never called.
Index ¶
Constants ¶
const Current = current
Current is the platform the app was built for.
Variables ¶
This section is empty.
Functions ¶
func ByPlatform ¶
ByPlatform returns the element the current platform's builder in v makes (see Views).
Types ¶
type Platform ¶
type Platform uint8
Platform is a set of platforms. Combine them with |: Windows|Linux.
const ( Windows Platform = 1 << iota // MacOS is macOS, not iOS. MacOS // Linux is Linux desktops (and other Unix desktops: FreeBSD, // OpenBSD), not Android. Linux Android IOS // Web is the browser (WebAssembly). Web // Desktop is Windows, macOS and Linux; Mobile is Android and iOS. Desktop = Windows | MacOS | Linux Mobile = Android | IOS // Any is every platform. Any = Desktop | Mobile | Web )
type Views ¶
type Views struct {
Windows, MacOS, Linux, Android, IOS, Web func() base.Element
Desktop, Mobile func() base.Element
Default func() base.Element
}
Views is an element for each platform, for ByPlatform. A specific platform's builder wins over Desktop or Mobile, and those over Default; a platform with none of them shows nothing.