autoinit

package
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package autoinit allows interaction between go-app components and mdc.autoInit().

See https://github.com/material-components/material-components-web/tree/master/packages/mdc-auto-init for more detail.

Typical use occur in OnMount() where the component element is initialized and the value attached to the component is referenced in a field of the go-app component.

type TopAppBar struct {
	app.Compo
	autoinit.AutoInit
	.....
}

func (c *TopAppBar) OnMount(_ app.Context) {
	c.api = c.AutoInitComponent(c.JSValue(), autoinit.MDCTopAppBar)
}

Index

Constants

View Source
const MdcAutoInitData = "mdc-auto-init"

MdcAutoInitData is the data attribute constant.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoInit

type AutoInit struct{}

func (*AutoInit) AutoInitComponent

func (ai *AutoInit) AutoInitComponent(compo app.Value, name MDCName) app.Value

AutoInitComponent is short for MdcAutoInitWindow() and return name.GetFrom(compo).

func (*AutoInit) MdcAutoInit

func (ai *AutoInit) MdcAutoInit(root app.Value)

MdcAutoInit calls the js function mdc.autoInit() with the provided value

func (*AutoInit) MdcAutoInitWindow

func (ai *AutoInit) MdcAutoInitWindow()

MdcAutoInitWindow is short for MdcAutoInit(app.Window().get("Document"))

type MDCName

type MDCName string

MDCName defines the constants for the keys registered using autoInit.register().

const MDCBanner MDCName = "MDCBanner"
const MDCCheckbox MDCName = "MDCCheckbox"
const MDCChip MDCName = "MDCChip"
const MDCChipSet MDCName = "MDCChipSet"
const MDCCircularProgress MDCName = "MDCCircularProgress"
const MDCDataTable MDCName = "MDCDataTable"
const MDCDialog MDCName = "MDCDialog"
const MDCDrawer MDCName = "MDCDrawer"
const MDCFloatingLabel MDCName = "MDCFloatingLabel"
const MDCFormField MDCName = "MDCFormField"
const MDCIconButtonToggle MDCName = "MDCIconButtonToggle"
const MDCLineRipple MDCName = "MDCLineRipple"
const MDCLinearProgress MDCName = "MDCLinearProgress"
const MDCList MDCName = "MDCList"
const MDCMenu MDCName = "MDCMenu"
const MDCMenuSurface MDCName = "MDCMenuSurface"
const MDCNotchedOutline MDCName = "MDCNotchedOutline"
const MDCRadio MDCName = "MDCRadio"
const MDCRipple MDCName = "MDCRipple"
const MDCSegmentedButton MDCName = "MDCSegmentedButton"
const MDCSelect MDCName = "MDCSelect"
const MDCSlider MDCName = "MDCSlider"
const MDCSnackbar MDCName = "MDCSnackbar"
const MDCSwitch MDCName = "MDCSwitch"
const MDCTabBar MDCName = "MDCTabBar"
const MDCTextField MDCName = "MDCTextField"
const MDCTooltip MDCName = "MDCTooltip"
const MDCTopAppBar MDCName = "MDCTopAppBar"

func (MDCName) DataMdcAutoInitButton added in v0.2.3

func (n MDCName) DataMdcAutoInitButton(button app.HTMLButton) app.HTMLButton

DataMdcAutoInitButton is a convenience method for setting the data-mdc-auto-init attribute on a Button.

func (MDCName) DataMdcAutoInitDiv added in v0.2.2

func (n MDCName) DataMdcAutoInitDiv(div app.HTMLDiv) app.HTMLDiv

DataMdcAutoInitDiv is a convenience method for setting the data-mdc-auto-init attribute on a Div.

func (MDCName) DataMdcAutoInitHeader added in v0.2.4

func (n MDCName) DataMdcAutoInitHeader(header app.HTMLHeader) app.HTMLHeader

DataMdcAutoInitHeader is a convenience method for setting the data-mdc-auto-init attribute on a Header.

func (MDCName) DataMdcAutoInitSpan added in v0.2.4

func (n MDCName) DataMdcAutoInitSpan(set app.HTMLSpan) app.HTMLSpan

DataMdcAutoInitSpan is a convenience method for setting the data-mdc-auto-init attribute on a Span.

func (MDCName) GetFrom

func (n MDCName) GetFrom(value app.Value) app.Value

GetFrom calls value.Get(string(MDCName))

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL