Documentation ¶
Index ¶
- Constants
- Variables
- type A
- type Button
- type CSSStyleDeclaration
- type Canvas
- type CanvasGradient
- type CanvasImageSource
- type CanvasPattern
- type Color
- type CompositeOperation
- type Context2D
- func (c *Context2D) Arc(center *Point, radius, startAngle, endAngle float64, clockwise bool)
- func (c *Context2D) ArcTo(p, q *Point, radius float64)
- func (c *Context2D) BeginPath()
- func (c *Context2D) BézierCurveTo(p, q, r *Point)
- func (c *Context2D) ClearRect(r *Rect)
- func (c *Context2D) Clip()
- func (c *Context2D) ClosePath()
- func (c *Context2D) CreateImageData() ImageData
- func (c *Context2D) CreateLinearGradient(start, end *Point) CanvasGradient
- func (c *Context2D) CreatePattern(s CanvasImageSource, r Repetition) CanvasPattern
- func (c *Context2D) CreateRadialGradient(centerA *Point, radiusA float64, centerB *Point, radiusB float64) CanvasGradient
- func (c *Context2D) DrawFocusIfNeeded()
- func (c *Context2D) DrawImage(srcImage CanvasImageSource, srcRect, dstRect *Rect)
- func (c *Context2D) Fill()
- func (c *Context2D) FillRect(r *Rect)
- func (c *Context2D) FillText(text string, p *Point)
- func (c *Context2D) GetImageData(r *Rect) ImageData
- func (c *Context2D) IsPointInPath(p *Point) bool
- func (c *Context2D) IsPointInStroke(p *Point) bool
- func (c *Context2D) LineDash() []int
- func (c *Context2D) LineTo(p *Point)
- func (c *Context2D) MeasureText(text string) float64
- func (c *Context2D) MoveTo(p *Point)
- func (c *Context2D) PutImageData()
- func (c *Context2D) QuadraticCurveTo(p, q, r *Point)
- func (c *Context2D) Rect(r *Rect)
- func (c *Context2D) ResetTransform()
- func (c *Context2D) Restore()
- func (c *Context2D) Rotate(angle float64)
- func (c *Context2D) Save()
- func (c *Context2D) SaveRestore() func()
- func (c *Context2D) Scale(x, y float64)
- func (c *Context2D) ScrollPathIntoView()
- func (c *Context2D) SetLineDash(pattern []float64)
- func (c *Context2D) SetTransform(m Matrix)
- func (c *Context2D) Stroke()
- func (c *Context2D) StrokeRect(r *Rect)
- func (c *Context2D) StrokeText(text string, p *Point)
- func (c *Context2D) Transform(m Matrix)
- func (c *Context2D) Translate(p *Point)
- type DOMString
- type Display
- type Div
- type Document
- type Element
- func (e *Element) Append(v interface{}) Node
- func (n Element) AppendNode(child Node)
- func (n Element) Children() []Node
- func (e *Element) OnClick(cb func(MouseEvent)) Unsubscribe
- func (e *Element) OnMouseDown(cb func(MouseEvent)) Unsubscribe
- func (e *Element) OnMouseMove(cb func(MouseEvent)) Unsubscribe
- func (e *Element) OnMouseUp(cb func(MouseEvent)) Unsubscribe
- func (e *Element) Text() Text
- func (e *Element) VisibleRect() *Rect
- type ElementProvider
- type EventTarget
- type FlexDirection
- type Font
- type HashChangeEvent
- type ImageData
- type LineCap
- type LineJoin
- type Location
- type Matrix
- type MouseButton
- type MouseEvent
- type Node
- type Option
- type Paragraph
- type Point
- type Position
- type Rect
- type Repetition
- type Select
- type Source
- type Span
- type Table
- type Td
- type Text
- type TextAlign
- type TextBaseline
- type TextDirection
- type Th
- type Tr
- type Unsubscribe
- type Video
- type Window
- func (w *Window) OnLoad(cb func()) Unsubscribe
- func (w *Window) OnScroll(cb func()) Unsubscribe
- func (w *Window) RepeatTimer(frequency time.Duration, cb func()) Unsubscribe
- func (w *Window) RequestAnimationFrame(cb func()) Unsubscribe
- func (w *Window) Timer(delay time.Duration, cb func()) Unsubscribe
- type WindowProxy
Constants ¶
const ( LeftMouseButton = MouseButton(iota) MiddleMouseButton RightMouseButton )
Variables ¶
var Win = &Window{Object: js.Global.Get("window")}
Win is the global window.
Functions ¶
This section is empty.
Types ¶
type A ¶
type A struct{ *Element }
A represents an HTML <A> element.
func (A) AppendNode ¶
func (n A) AppendNode(child Node)
type Button ¶
type Button struct{ *Element }
Button represents an HTML <button> element.
func (Button) AppendNode ¶
func (n Button) AppendNode(child Node)
type CSSStyleDeclaration ¶
type CSSStyleDeclaration struct { *js.Object AlignContent string `js:"alignContent"` AlignItems string `js:"alignItems"` AlignSelf string `js:"AlignSelf"` AlignmentBaseline string `js:"alignmentBaseline"` All string `js:"all"` Animation string `js:"animation"` AnimationDelay string `js:"animationDelay"` AnimationDirection string `js:"animationDirection"` AnimationDuration string `js:"animationDuration"` AnimationFillMode string `js:"animationFillMode"` AnimationIterationCount string `js:"animationIterationCount"` AnimationName string `js:"animationName"` AnimationPlayState string `js:"animationPlayState"` AnimationTimingFunction string `js:"animationTimingFunction"` BackfaceVisibility string `js:"backfaceVisibility"` Background string `js:"background"` BackgroundAttachment string `js:"backgroundAttachment"` BackgroundBlendMode string `js:"backgroundBlendMode"` BackgroundClip string `js:"backgroundClip"` BackgroundColor Color `js:"backgroundColor"` BackgroundImage string `js:"backgroundImage"` BackgroundOrigin string `js:"backgroundOrigin"` BackgroundPosition string `js:"backgroundPosition"` BackgroundPositionX string `js:"backgroundPositionX"` BackgroundPositionY string `js:"backgroundPositionY"` BackgroundRepeat string `js:"backgroundRepeat"` BackgroundRepeatX string `js:"backgroundRepeatX"` BackgroundRepeatY string `js:"backgroundRepeatY"` BackgroundSize string `js:"backgroundSize"` BaselineShift string `js:"baselineShift"` Border string `js:"border"` BorderBottom string `js:"borderBottom"` BorderBottomColor Color `js:"borderBottomColor"` BorderBottomLeftRadius string `js:"borderBottomLeftRadius"` BorderBottomRightRadius string `js:"borderBottomRightRadius"` BorderBottomStyle string `js:"borderBottomStyle"` BorderBottomWidth string `js:"borderBottomWidth"` BorderCollapse string `js:"borderCollapse"` BorderColor Color `js:"borderColor"` BorderImage string `js:"borderImage"` BorderImageOutset string `js:"borderImageOutset"` BorderImageRepeat string `js:"borderImageRepeat"` BorderImageSlice string `js:"borderImageSlice"` BorderImageSource string `js:"borderImageSource"` BorderImageWidth string `js:"borderImageWidth"` BorderLeft string `js:"borderLeft"` BorderLeftColor Color `js:"borderLeftColor"` BorderLeftStyle string `js:"borderLeftStyle"` BorderLeftWidth string `js:"borderLeftWidth"` BorderRadius string `js:"borderRadius"` BorderRight string `js:"borderRight"` BorderRightColor Color `js:"borderRightColor"` BorderRightStyle string `js:"borderRightStyle"` BorderRightWidth string `js:"borderRightWidth"` BorderSpacing string `js:"borderSpacing"` BorderStyle string `js:"borderStyle"` BorderTop string `js:"borderTop"` BorderTopColor Color `js:"borderTopColor"` BorderTopLeftRadius string `js:"borderTopLeftRadius"` BorderTopRightRadius string `js:"borderTopRightRadius"` BorderTopStyle string `js:"borderTopStyle"` BorderTopWidth string `js:"borderTopWidth"` BorderWidth string `js:"borderWidth"` Bottom string `js:"bottom"` BoxShadow string `js:"boxShadow"` BoxSizing string `js:"boxSizing"` BreakAfter string `js:"breakAfter"` BreakBefore string `js:"breakBefore"` BreakInside string `js:"breakInside"` BufferedRendering string `js:"bufferedRendering"` CaptionSide string `js:"captionSide"` Clear string `js:"clear"` Clip string `js:"clip"` ClipPath string `js:"clipPath"` ClipRule string `js:"clipRule"` Color Color `js:"color"` ColorInterpolation string `js:"colorInterpolation"` ColorInterpolationFilters string `js:"colorInterpolationFilters"` ColorRendering string `js:"colorRendering"` ColumnCount string `js:"columnCount"` ColumnFill string `js:"columnFill"` ColumnGap string `js:"columnGap"` ColumnRule string `js:"columnRule"` ColumnRuleColor Color `js:"columnRuleColor"` ColumnRuleStyle string `js:"columnRuleStyle"` ColumnRuleWidth string `js:"columnRuleWidth"` ColumnSpan string `js:"columnSpan"` ColumnWidth string `js:"columnWidth"` Columns string `js:"columns"` Content string `js:"content"` CounterIncrement string `js:"counterIncrement"` CounterReset string `js:"counterReset"` CSSFloat string `js:"cssFloat"` CSSText string `js:"cssText"` Cursor string `js:"cursor"` Cx string `js:"cx"` Cy string `js:"cy"` Direction string `js:"direction"` Display Display `js:"display"` DominantBaseline string `js:"dominantBaseline"` EmptyCells string `js:"emptyCells"` Fill string `js:"fill"` FillOpacity string `js:"fillOpacity"` FillRule string `js:"fillRule"` Filter string `js:"filter"` Flex string `js:"flex"` FlexBasis string `js:"flexBasis"` FlexDirection FlexDirection `js:"flexDirection"` FlexFlow string `js:"flexFlow"` FlexGrow string `js:"flexGrow"` FlexShrink string `js:"flexShrink"` FlexWrap string `js:"flexWrap"` Float string `js:"float"` FloodColor string `js:"floodColor"` FloodOpacity string `js:"floodOpacity"` Font string `js:"font"` FontFamily string `js:"fontFamily"` FontFeatureSettings string `js:"fontFeatureSettings"` FontKerning string `js:"fontKerning"` FontSize string `js:"fontSize"` FontStretch string `js:"fontStretch"` FontStyle string `js:"fontStyle"` FontVariant string `js:"fontVariant"` FontVariantLigatures string `js:"fontVariantLigatures"` FontWeight string `js:"fontWeight"` Height int `js:"height"` ImageRendering string `js:"imageRendering"` Isolation string `js:"isolation"` JustifyContent string `js:"justifyContent"` Left string `js:"left"` Length string `js:"length int"` LetterSpacing string `js:"letterSpacing"` LightingColor Color `js:"lightingColor"` LineHeight string `js:"lineHeight"` ListStyle string `js:"listStyle"` ListStyleImage string `js:"listStyleImage"` ListStylePosition string `js:"listStylePosition"` ListStyleType string `js:"listStyleType"` Margin string `js:"margin"` MarginBottom string `js:"marginBottom"` MarginLeft string `js:"marginLeft"` MarginRight string `js:"marginRight"` MarginTop string `js:"marginTop"` Marker string `js:"marker"` MarkerEnd string `js:"markerEnd"` MarkerMid string `js:"markerMid"` MarkerStart string `js:"markerStart"` Mask string `js:"mask"` MaskType string `js:"maskType"` MaxHeight int `js:"maxHeight"` MaxWidth int `js:"maxWidth"` MaxZoom string `js:"maxZoom"` MinHeight int `js:"minHeight"` MinWidth int `js:"minWidth"` MinZoom string `js:"minZoom"` MixBlendMode string `js:"mixBlendMode"` Motion string `js:"motion"` MotionOffset string `js:"motionOffset"` MotionPath string `js:"motionPath"` MotionRotation string `js:"motionRotation"` ObjectFit string `js:"objectFit"` ObjectPosition string `js:"objectPosition"` Opacity string `js:"opacity"` Order string `js:"order"` Orientation string `js:"orientation"` Orphans string `js:"orphans"` Outline string `js:"outline"` OutlineColor Color `js:"outlineColor"` OutlineOffset string `js:"outlineOffset"` OutlineStyle string `js:"outlineStyle"` OutlineWidth string `js:"outlineWidth"` Overflow string `js:"overflow"` OverflowWrap string `js:"overflowWrap"` OverflowX string `js:"overflowX"` OverflowY string `js:"overflowY"` Padding string `js:"padding"` PaddingBottom string `js:"paddingBottom"` PaddingLeft string `js:"paddingLeft"` PaddingRight string `js:"paddingRight"` PaddingTop string `js:"paddingTop"` Page string `js:"page"` PageBreakAfter string `js:"pageBreakAfter"` PageBreakBefore string `js:"pageBreakBefore"` PageBreakInside string `js:"pageBreakInside"` PaintOrder string `js:"paintOrder"` ParentRule string `js:"parentRule"` Perspective string `js:"perspective"` PerspectiveOrigin string `js:"perspectiveOrigin"` PointerEvents string `js:"pointerEvents"` Position Position `js:"position"` Quotes string `js:"quotes"` R string `js:"r"` Resize string `js:"resize"` Right string `js:"right"` Rx string `js:"rx"` Ry string `js:"ry"` ShapeImageThreshold string `js:"shapeImageThreshold"` ShapeMargin string `js:"shapeMargin"` ShapeOutside string `js:"shapeOutside"` ShapeRendering string `js:"shapeRendering"` Size string `js:"size"` Speak string `js:"speak"` Src string `js:"src"` StopColor Color `js:"stopColor"` StopOpacity string `js:"stopOpacity"` Stroke string `js:"stroke"` StrokeDasharray string `js:"strokeDasharray"` StrokeDashoffset string `js:"strokeDashoffset"` StrokeLinecap string `js:"strokeLinecap"` StrokeLinejoin string `js:"strokeLinejoin"` StrokeMiterlimit string `js:"strokeMiterlimit"` StrokeOpacity string `js:"strokeOpacity"` StrokeWidth string `js:"strokeWidth"` TabSize string `js:"tabSize"` TableLayout string `js:"tableLayout"` TextAlign string `js:"textAlign"` TextAlignLast string `js:"textAlignLast"` TextAnchor string `js:"textAnchor"` TextCombineUpright string `js:"textCombineUpright"` TextDecoration string `js:"textDecoration"` TextIndent string `js:"textIndent"` TextOrientation string `js:"textOrientation"` TextOverflow string `js:"textOverflow"` TextRendering string `js:"textRendering"` TextShadow string `js:"textShadow"` TextTransform string `js:"textTransform"` Top string `js:"top"` TouchAction string `js:"touchAction"` Transform string `js:"transform"` TransformOrigin string `js:"transformOrigin"` TransformStyle string `js:"transformStyle"` Transition string `js:"transition"` TransitionDelay string `js:"transitionDelay"` TransitionDuration string `js:"transitionDuration"` TransitionProperty string `js:"transitionProperty"` TransitionTimingFunction string `js:"transitionTimingFunction"` UnicodeBidi string `js:"unicodeBidi"` UnicodeRange string `js:"unicodeRange"` UserZoom string `js:"userZoom"` VectorEffect string `js:"vectorEffect"` VerticalAlign string `js:"verticalAlign"` Visibility string `js:"visibility"` WhiteSpace string `js:"whiteSpace"` Widows string `js:"widows"` Width int `js:"width"` WillChange string `js:"willChange"` WordBreak string `js:"wordBreak"` WordSpacing string `js:"wordSpacing"` WordWrap string `js:"wordWrap"` WritingMode string `js:"writingMode"` X string `js:"x"` Y string `js:"y"` ZIndex string `js:"zIndex"` Zoom string `js:"zoom"` }
type Canvas ¶
type Canvas struct{ *Element }
Canvas represents an HTML <canvas> element.
func (Canvas) AppendNode ¶
func (n Canvas) AppendNode(child Node)
type CanvasGradient ¶
type CanvasImageSource ¶
type CanvasImageSource interface{}
CanvasImageSource is any of the following types: HTMLImageElement, HTMLVideoElement, HTMLCanvasElement, or ImageBitmap.
type CanvasPattern ¶
type Color ¶
type Color string
Color is a CSS color.
type CompositeOperation ¶
type CompositeOperation string
CompositeOperation is an enumerator of alpha blending composite functions.
type Context2D ¶
type Context2D struct { *js.Object // LineWidth is the width of lines. LineWidth float64 `js:"lineWidth"` // LineCap specifies the style of endings on the end of lines. LineCap LineCap `js:"lineCap"` // LineJoin specifies the type of corners where two lines meet. LineJoin LineJoin `js:"lineJoin"` // MiterLimit is the miter limit ratio. MiterLimit float64 `js:"miterLimit"` // LineDashOffset specifies where to start a dash array on a line. LineDashOffset float64 `js:"lineDashOffset"` // Font is the current font to use for text drawing. Font Font `js:"font"` // TextAlign specifies text alignment when drawing text. TextAlign TextAlign `js:"textAlign"` // TextBaseline specifies the text baseline when drawing text. TextBaseline TextBaseline `js:"textBaseline"` // TextDirection specifies the direction when drawing text. TextDirection TextDirection `js:"direction"` // FillStyle is the color or style to use inside shapes. FillStyle interface{} `js:"fillStyle"` // StrokeStyle is the color or style to use for the lines around shapes. StrokeStyle interface{} `js:"strokeStyle"` // ShadowBlur controls the amount of blur. ShadowBlur float64 `js:"shadowBlur"` // ShadowColor is the color of the shadow. ShadowColor Color `js:"shadowColor"` // ShadowOffsetX is the horizonal offset of the shadow. ShadowOffsetX float64 `js:"shadowOffsetX"` // ShadowOffsetY is the vertical offset of the shadow. ShadowOffsetY float64 `js:"shadowOffsetY"` // GlobalAlpha is the alpha value that is applied to shapes and images before // they are composited onto the canvas. GlobalAlpha float64 `js:"globalAlpha"` // GlobalCompositeOperation sets how shapes and images are drawn onto the existing bitmap. GlobalCompositeOperation CompositeOperation `js:"globalCompositeOperation"` // ImageSmoothingEnabled is true if images should be smoothed when scaled. ImageSmoothingEnabled bool `js:"imageSmoothingEnabled"` }
Context2D represents a func (c *Context2D)
func (*Context2D) Arc ¶
Arc adds an arc to the path which is centered at center with the specified radius starting at startAngle and ending at endAngle going in the given direction.
func (*Context2D) ArcTo ¶
ArcTo adds an arc to the path with the given control points and radius, connected to the previous point by a straight line.
func (*Context2D) BeginPath ¶
func (c *Context2D) BeginPath()
BeginPath starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path.
func (*Context2D) BézierCurveTo ¶
BézierCurveTo adds a cubic Bézier curve to the path. It requires three points. The first two points are control points and the third one is the end point. The starting point is the last point in the current path, which can be changed using moveTo() before creating the Bézier curve.
func (*Context2D) ClearRect ¶
ClearRect sets all pixels in the rectangle to transparent black, erasing any previously drawn content.
func (*Context2D) Clip ¶
func (c *Context2D) Clip()
Clip creates a clipping path from the current sub-paths. Everything drawn after calling Clip appears inside the clipping path only.
func (*Context2D) ClosePath ¶
func (c *Context2D) ClosePath()
ClosePath causes the point of the pen to move back to the start of the current sub-path. It tries to draw a straight line from the current point to the start. If the shape has already been closed or has only one point, this function does nothing.
func (*Context2D) CreateImageData ¶
CreateImageData creates a new, blank ImageData object with the specified dimensions. All of the pixels in the new object are transparent black.
func (*Context2D) CreateLinearGradient ¶
func (c *Context2D) CreateLinearGradient(start, end *Point) CanvasGradient
CreateLinearGradient creates a linear gradient along the line given by the coordinates represented by the parameters.
func (*Context2D) CreatePattern ¶
func (c *Context2D) CreatePattern(s CanvasImageSource, r Repetition) CanvasPattern
CreatePattern creates a pattern using the specified image and repetition.
func (*Context2D) CreateRadialGradient ¶
func (c *Context2D) CreateRadialGradient(centerA *Point, radiusA float64, centerB *Point, radiusB float64) CanvasGradient
CreateRadialGradient creates a radial gradient given by the coordinates of the two circles and radii.
func (*Context2D) DrawFocusIfNeeded ¶
func (c *Context2D) DrawFocusIfNeeded()
DrawFocusIfNeeded will draw a focus ring around the current path if a given element is focused.
func (*Context2D) DrawImage ¶
func (c *Context2D) DrawImage(srcImage CanvasImageSource, srcRect, dstRect *Rect)
DrawImage draws the specified image.
func (*Context2D) Fill ¶
func (c *Context2D) Fill()
Fill fills the subpaths with the current fill style.
func (*Context2D) GetImageData ¶
GetImageData returns an ImageData object representing the underlying pixel data for the area of the canvas denoted by rect.
func (*Context2D) IsPointInPath ¶
IsPointInPath returns true if the specified point is contained in the current path.
func (*Context2D) IsPointInStroke ¶
IsPointInStroke returns true if the specified point is inside the area contained by the stroking of a path.
func (*Context2D) LineDash ¶
LineDash returns the current line dash pattern as an array array containing an even number of non-negative numbers.
func (*Context2D) MeasureText ¶
MeasureText returns the measured width of the text.
func (*Context2D) PutImageData ¶
func (c *Context2D) PutImageData()
PutImageData paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, only the pixels from that rectangle are painted.
func (*Context2D) QuadraticCurveTo ¶
QuadraticCurveTo adds a quadratic curve to the current path.
func (*Context2D) ResetTransform ¶
func (c *Context2D) ResetTransform()
ResetTransform resets the current transformation matrix with identity.
func (*Context2D) Restore ¶
func (c *Context2D) Restore()
Restore restores the drawing style state to the last element on the 'state stack' saved by Save().
func (*Context2D) Rotate ¶
Rotate applies a clockwise rotation in angle degrees to the current transformation matrix.
func (*Context2D) Save ¶
func (c *Context2D) Save()
Save stores the current drawing style state using a stack so you can revert any change you make to it using Restore().
func (*Context2D) SaveRestore ¶
func (c *Context2D) SaveRestore() func()
SaveRestore calls Save() and returns Restore. This is a convenience function so you can start a function with:
defer ctx.SaveRestore()()
func (*Context2D) ScrollPathIntoView ¶
func (c *Context2D) ScrollPathIntoView()
ScrollPathIntoView scrolls the current path or a given path into the view.
func (*Context2D) SetLineDash ¶
SetLineDash sets the current line dash pattern.
func (*Context2D) SetTransform ¶
SetTransform replaces the current transformation matrix with m.
func (*Context2D) Stroke ¶
func (c *Context2D) Stroke()
Stroke strokes the subpaths with the current stroke style.
func (*Context2D) StrokeRect ¶
StrokeRect paints a rectangle using the current stroke style.
func (*Context2D) StrokeText ¶
StrokeText draws with a stroke a the text at the given position.
type Display ¶
type Display string
Display is a CSS display enumerator.
const ( DisplayBlock Display = "block" DisplayFlex Display = "flex" DisplayGrid Display = "grid" DisplayInherit Display = "inherit" DisplayInitial Display = "initial" DisplayInline Display = "inline" DisplayInlineBlock Display = "inline-block" DisplayInlineFlex Display = "inline-flex" DisplayInlineGrid Display = "inline-grid" DisplayInlineTable Display = "inline-table" DisplayListItem Display = "list-item" DisplayNone Display = "list-none" DisplayRunIn Display = "run-in" DisplayTable Display = "table" DisplayTableCaption Display = "table-caption" DisplayTableCell Display = "table-cell" DisplayTableColumn Display = "table-column" DisplayTableColumnGroup Display = "table-column-group" DisplayTableHeaderGroup Display = "table-header-group" DisplayTableRow Display = "table-row" DisplayTableRowGroup Display = "table-row-group" )
type Div ¶
type Div struct{ *Element }
Div represents an HTML <div> element.
func (Div) AppendNode ¶
func (n Div) AppendNode(child Node)
type Document ¶
type Document struct{ *Element }
Document is the root of DOM.
func (Document) AppendNode ¶
func (n Document) AppendNode(child Node)
type Element ¶
type Element struct { Width int `js:"width"` Height int `js:"height"` OffsetLeft int `js:"offsetLeft"` OffsetTop int `js:"offsetTop"` WidthV interface{} `js:"width"` HeightV interface{} `js:"height"` Style *CSSStyleDeclaration `js:"style"` // contains filtered or unexported fields }
Element is represents a DOM element type.
func (*Element) Append ¶
Append adds v to the end of element's children. If v is a node then it is simply appended, otherwise the value will be converted to a string and appended as a text node.
func (Element) AppendNode ¶
func (n Element) AppendNode(child Node)
func (*Element) OnClick ¶
func (e *Element) OnClick(cb func(MouseEvent)) Unsubscribe
OnClick registers a click handler for the element.
func (*Element) OnMouseDown ¶
func (e *Element) OnMouseDown(cb func(MouseEvent)) Unsubscribe
OnMouseDown registers a mouse-down handler for the element.
func (*Element) OnMouseMove ¶
func (e *Element) OnMouseMove(cb func(MouseEvent)) Unsubscribe
OnMouseMove registers a mouse-move handler for the element.
func (*Element) OnMouseUp ¶
func (e *Element) OnMouseUp(cb func(MouseEvent)) Unsubscribe
OnMouseUp registers a mouse-up handler for the element.
func (*Element) Text ¶
Text returns the child text node for the element, creating it if it doesn't already exist.
func (*Element) VisibleRect ¶
VisibleRect returns the visible region of the element in the viewport.
type ElementProvider ¶
type ElementProvider interface { // Element returns the DOM element that represents the type. Element() *Element }
ElementProvider is the interface implemented by types that are represented by a DOM element.
type EventTarget ¶
type EventTarget interface{}
type FlexDirection ¶
type FlexDirection string
FlexDirection is a CSS flexbox direction enumerator.
const ( FlexColumn FlexDirection = "column" FlexColumnReverse FlexDirection = "column-reverse" FlexInherit FlexDirection = "inherit" FlexInitial FlexDirection = "initial" FlexRow FlexDirection = "row" FlexRowReverse FlexDirection = "row-reverse" )
type HashChangeEvent ¶
type HashChangeEvent struct { *js.Object // NewURL is the new URL to which the window is navigating. NewURL DOMString `js:"newURL"` // OldURL is the old URL from which the window is navigating. OldURL DOMString `js:"oldURL"` }
HashChangeEvent holds information about a URL hash change.
type Location ¶
type Location struct { *js.Object // Hash is the anchor part (#) of a URL Hash string `js:"hash"` // Host is the hostname and port number of a URL Host string `js:"host"` // Hostname is the hostname of a URL Hostname string `js:"hostname"` // Href is the entire URL Href string `js:"href"` // Origin is the protocol, hostname and port number of a URL Origin string `js:"origin"` // Pathname is the path name of a URL Pathname string `js:"pathname"` // Port is the port number of a URL Port int `js:"port"` // Protocol is the protocol of a URL Protocol string `js:"protocol"` // Search is the querystring part of a URL Search string `js:"search"` }
Location holds information about a URL
func (Location) OnHashChange ¶
func (Location) OnHashChange(cb func(HashChangeEvent)) Unsubscribe
OnHashChange registers a handler for changes to the Hash of the window's URL.
type Matrix ¶
Matrix represents a 3x3 matrix.
╭ ╮ │ A C E │ │ B D F │ │ 0 0 1 │ ╰ ╯
func (*Matrix) Translation ¶
Translation returns the translation part of the matrix as a point.
type MouseEvent ¶
type MouseEvent struct { *js.Object // Target represents the event target (the topmost target in the DOM tree). // Target EventTarget `js:"target"` // Type represents the type of event. Type DOMString `js:"type"` // Bubbles represents whether the event normally bubbles or not Bubbles bool `js:"bubbles"` // Cancelable represents whether the event is cancellable or not? Cancelable bool `js:"cancelable"` // View is the document.defaultView (window of the document) View WindowProxy `js:"view"` // Detail is a count of consecutive clicks that happened in a short amount // of time, incremented by one. Detail int `js:"detail"` // CurrentTarget is the node that had the event listener attached. CurrentTarget EventTarget `js:"currentTarget"` // RelatedTarget is used for mouseover, mouseout, mouseenter and mouseleave // events: the target of the complementary event (the mouseleave target in // the case of a mouseenter event). null otherwise. RelatedTarget EventTarget `js:"relatedTarget"` // ScreenX is the X coordinate of the mouse pointer in global (screen) // coordinates. ScreenX int `js:"screenX"` // ScreenY is the Y coordinate of the mouse pointer in global (screen) // coordinates. ScreenY int `js:"screenY"` // ClientX is the X coordinate of the mouse pointer in local (DOM content) // coordinates. ClientX int `js:"clientX"` // ClientY is the Y coordinate of the mouse pointer in local (DOM content) // coordinates. ClientY int `js:"clientY"` // PageX is the X coordinate of the mouse pointer in relative to the whole // document. PageX int `js:"pageX"` // PageY is the Y coordinate of the mouse pointer in relative to the whole // document. PageY int `js:"pageY"` // Button is the mouse button pressed when the event was fired. // For mice configured for left handed use in which the button actions are // reversed the values are instead read from right to left. Button MouseButton `js:"button"` // Buttons represents the buttons being pressed when the mouse event was // fired: Left button=1, Right button=2, Middle (wheel) button=4, 4th button // (typically, "Browser Back" button)=8, 5th button (typically, // "Browser Forward" button)=16. If two or more buttons are pressed, returns // the logical sum of the values. E.g., if Left button and Right button are // pressed, returns 3 (=1 | 2). Buttons uint `js:"buttons"` // CtrlKey is true if the control key was down when the event was fired. false otherwise. CtrlKey bool `js:"ctrlKey"` // ShiftKey is true if the shift key was down when the event was fired. false otherwise. ShiftKey bool `js:"shiftKey"` // AltKey is true if the alt key was down when the event was fired. false otherwise. AltKey bool `js:"altKey"` // MetaKey is true if the meta key was down when the event was fired. false otherwise. MetaKey bool `js:"metaKey"` }
MouseEvent holds information about a mouse event.
func (*MouseEvent) PreventDefault ¶
func (m *MouseEvent) PreventDefault()
type Node ¶
type Node interface { // Children returns all the child nodes of this node. Children() []Node // AppendNode adds the child node at the end of the list of children. AppendNode(Node) // contains filtered or unexported methods }
Node is the interface implemented by DOM node types.
type Option ¶
type Option struct { *Element // Selected is true if the option is currently selected. Selected bool `js:"selected"` // Disabled is true if the option is currently disabled. Disabled bool `js:"disabled"` // Value is the value of the option. Value string `js:"value"` }
Option represents an HTML <option> element.
func (Option) AppendNode ¶
func (n Option) AppendNode(child Node)
type Paragraph ¶
type Paragraph struct{ *Element }
Paragraph represents an HTML <p> element.
func (Paragraph) AppendNode ¶
func (n Paragraph) AppendNode(child Node)
type Point ¶
type Point struct{ X, Y float64 }
Point represents a two-dimensional position.
type Rect ¶
type Rect struct{ TL, BR *Point }
Rect represents a rectangle.
type Repetition ¶
type Repetition string
Repetition is an enumerator of pattern repetition modes.
const ( Repeat Repetition = "repeat" RepeatX Repetition = "repeat-x" RepeatY Repetition = "repeat-y" NoRepeat Repetition = "no-repeat" )
type Select ¶
type Select struct { *Element // Value is the currently currently selected value. Value string `js:"value"` // SelectedIndex is the index of the currently selected option. SelectedIndex int `js:"selectedIndex"` }
Select represents an HTML <select> element.
func (Select) AppendNode ¶
func (n Select) AppendNode(child Node)
func (*Select) OnChange ¶
func (s *Select) OnChange(cb func()) Unsubscribe
OnChange registers a change handler for the Select element.
type Source ¶
func (Source) AppendNode ¶
func (n Source) AppendNode(child Node)
type Span ¶
type Span struct{ *Element }
Span represents an HTML <span> element.
func (Span) AppendNode ¶
func (n Span) AppendNode(child Node)
type Table ¶
type Table struct{ *Element }
Table represents an HTML <table> element.
func (Table) AppendNode ¶
func (n Table) AppendNode(child Node)
type Td ¶
type Td struct{ *Element }
Td represents an HTML <td> element.
func (Td) AppendNode ¶
func (n Td) AppendNode(child Node)
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text represents a text node.
func (Text) AppendNode ¶
func (n Text) AppendNode(child Node)
type TextBaseline ¶
type TextBaseline string
TextBaseline is an enumerator of text baselines.
const ( TextBaselineTop TextBaseline = "top" TextBaselineHanging TextBaseline = "hanging" TextBaselineMiddle TextBaseline = "middle" TextBaselineAlphabetic TextBaseline = "alphabetic" TextBaselineIdeographic TextBaseline = "ideographic" TextBaselineBottom TextBaseline = "bottom" )
type TextDirection ¶
type TextDirection string
TextDirection is an enumerator of text flow directions.
const ( TextDirectionLTR TextDirection = "ltr" TextDirectionRTL TextDirection = "rtl" TextDirectionInherit TextDirection = "inherit" )
type Th ¶
type Th struct{ *Element }
Th represents an HTML <th> element.
func (Th) AppendNode ¶
func (n Th) AppendNode(child Node)
type Tr ¶
type Tr struct{ *Element }
Tr represents an HTML <tr> element.
func (Tr) AppendNode ¶
func (n Tr) AppendNode(child Node)
type Unsubscribe ¶
type Unsubscribe func()
Unsubscribe is the function returned by event subscription methods, such as OnClick. Calling Unsubscribe will prevent the event notification from firing again.
type Video ¶
Video represents an HTML <video> element
func (Video) AppendNode ¶
func (n Video) AppendNode(child Node)
type Window ¶
type Window struct { *js.Object Location Location `js:"location"` DevicePixelRatio float64 `js:"devicePixelRatio"` InnerWidth int `js:"innerWidth"` InnerHeight int `js:"innerHeight"` // contains filtered or unexported fields }
Window represents a window that holds a document.
func (*Window) OnLoad ¶
func (w *Window) OnLoad(cb func()) Unsubscribe
OnLoad registers a load handler for the window.
func (*Window) OnScroll ¶
func (w *Window) OnScroll(cb func()) Unsubscribe
OnScroll calles cb whenever the window is scrolled.
func (*Window) RepeatTimer ¶
func (w *Window) RepeatTimer(frequency time.Duration, cb func()) Unsubscribe
RepeatTimer calls cb at the specified frequency until cancelled.
func (*Window) RequestAnimationFrame ¶
func (w *Window) RequestAnimationFrame(cb func()) Unsubscribe
RequestAnimationFrame attempts to call cb as soon as possible.
type WindowProxy ¶
type WindowProxy interface{}