web

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// EventTypeError means that a resource failed to load.
	EventTypeError = EventType("error")

	// EventTypeAbort means that the loading of a resource has been aborted.
	EventTypeAbort = EventType("abort")

	// EventTypeLoad means that a resource and its dependent resources have finished loading.
	EventTypeLoad = EventType("load")

	// EventTypeBeforeUnload means that the window, the document and its resources are about to be unloaded.
	EventTypeBeforeUnload = EventType("beforeunload")

	// EventTypeUnload means that the document or a dependent resource is being unloaded.
	EventTypeUnload = EventType("unload")

	// EventTypeOnline means that the browser has gained access to the network.
	EventTypeOnline = EventType("online")

	// EventTypeOffline means that the browser has lost access to the network.
	EventTypeOffline = EventType("offline")

	// EventTypeFocus means that an element has received focus (does not bubble).
	EventTypeFocus = EventType("focus")

	// EventTypeBlur means that an element has lost focus (does not bubble).
	EventTypeBlur = EventType("blur")

	// EventTypeOpen means that a WebSocket connection has been established.
	EventTypeOpen = EventType("open")

	// EventTypeMessage means that a message is received through a WebSocket.
	EventTypeMessage = EventType("message")

	// EventTypeClose means that a WebSocket connection has been closed.
	EventTypeClose = EventType("close")

	// EventTypePageHide means that a session history entry is being traversed from.
	EventTypePageHide = EventType("pagehide")

	// EventTypePageShow means that a session history entry is being traversed to.
	EventTypePageShow = EventType("pageshow")

	// EventTypePopState means that a session history entry is being navigated to (in certain cases).
	EventTypePopState = EventType("popstate")

	// EventTypeAnimationStart means that a CSS animation has started.
	EventTypeAnimationStart = EventType("animationstart")

	// EventTypeAnimationCancel means that a CSS animation has aborted.
	EventTypeAnimationCancel = EventType("animationcancel")

	// EventTypeAnimationEnd means that a CSS animation has completed.
	EventTypeAnimationEnd = EventType("animationend")

	// EventTypeAnimationiteration means that a CSS animation is repeated.
	EventTypeAnimationIteration = EventType("animationiteration")

	// EventTypeTransitionStart means that a CSS transition has actually started (fired after any delay).
	EventTypeTransitionStart = EventType("transitionstart")

	// EventTypeTransitionCancel means that a CSS transition has been cancelled.
	EventTypeTransitionCancel = EventType("transitioncancel")

	// EventTypeTransitionEnd means that a CSS transition has completed.
	EventTypeTransitionEnd = EventType("transitionend")

	// EventTypeTransitionRun means that a CSS transition has begun running (fired before any delay starts).
	EventTypeTransitionRun = EventType("transitionrun")

	// EventTypeReset means that the reset button is pressed.
	// https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reset_event
	EventTypeReset = EventType("reset")

	// EventTypeSubmit means that the submit button is pressed.
	// https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit_event
	EventTypeSubmit = EventType("submit")

	// EventTypeBeforePrint means that the print dialog is opened.
	EventTypeBeforePrint = EventType("beforeprint")

	// EventTypeAfterPrint means that the print dialog is closed.
	EventTypeAfterPrint = EventType("afterprint")

	// EventTypeCompositionStart means that the composition of a passage of text is prepared (similar to keydown for a keyboard input, but works with other inputs such as speech recognition).
	EventTypeCompositionStart = EventType("compositionstart")

	// EventTypeCompositionUpdate means that a character is added to a passage of text being composed.
	EventTypeCompositionUpdate = EventType("compositionupdate")

	// EventTypeCompositionEnd means that the composition of a passage of text has been completed or canceled.
	EventTypeCompositionEnd = EventType("compositionend")

	// EventTypeFullscreenChange means that an element was turned to fullscreen mode or back to normal mode.
	EventTypeFullscreenChange = EventType("fullscreenchange")

	// EventTypeFullscreenError means that It was impossible to switch to fullscreen mode for technical reasons or because the permission was denied.
	EventTypeFullscreenError = EventType("fullscreenerror")

	// EventTypeResize means that the document view has been resized.
	EventTypeResize = EventType("resize")

	// EventTypeScroll means that the document view or an element has been scrolled.
	EventTypeScroll = EventType("scroll")

	// EventTypeCut means that the selection has been cut and copied to the clipboard
	EventTypeCut = EventType("cut")

	// EventTypeCopy means that the selection has been copied to the clipboard
	EventTypeCopy = EventType("copy")

	// EventTypePaste means that the item from the clipboard has been pasted
	EventTypePaste = EventType("paste")

	// EventTypeKeyDown means that aNY key is pressed
	EventTypeKeyDown = EventType("keydown")

	// EventTypeKeyPress means that aNY key except Shift, Fn, CapsLock is in pressed position. (Fired continously.)
	EventTypeKeyPress = EventType("keypress")

	// EventTypeKeyUp means that aNY key is released
	EventTypeKeyUp = EventType("keyup")

	// EventTypeAuxClick means that a pointing device button (ANY non-primary button) has been pressed and released on an element.
	EventTypeAuxClick = EventType("auxclick")

	// EventTypeClick means that a pointing device button (ANY button; soon to be primary button only) has been pressed and released on an element.
	EventTypeClick = EventType("click")

	// EventTypeContextMenu means that the right button of the mouse is clicked (before the context menu is displayed).
	EventTypeContextMenu = EventType("contextmenu")

	// EventTypeDoubleClick means that a pointing device button is clicked twice on an element.
	EventTypeDoubleClick = EventType("dblclick")

	// EventTypeMouseDown means that a pointing device button is pressed on an element.
	EventTypeMouseDown = EventType("mousedown")

	// EventTypeMouseEnter means that a pointing device is moved onto the element that has the listener attached.
	EventTypeMouseEnter = EventType("mouseenter")

	// EventTypeMouseLeave means that a pointing device is moved off the element that has the listener attached.
	EventTypeMouseLeave = EventType("mouseleave")

	// EventTypeMouseMove means that a pointing device is moved over an element. (Fired continously as the mouse moves.)
	EventTypeMouseMove = EventType("mousemove")

	// EventTypeMouseOver means that a pointing device is moved onto the element that has the listener attached or onto one of its children.
	EventTypeMouseOver = EventType("mouseover")

	// EventTypeMouseOut means that a pointing device is moved off the element that has the listener attached or off one of its children.
	EventTypeMouseOut = EventType("mouseout")

	// EventTypeMouseUp means that a pointing device button is released over an element.
	EventTypeMouseUp = EventType("mouseup")

	// EventTypePointerLockChange means that the pointer was locked or released.
	EventTypePointerLockChange = EventType("pointerlockchange")

	// EventTypePointerLockError means that It was impossible to lock the pointer for technical reasons or because the permission was denied.
	EventTypePointerLockError = EventType("pointerlockerror")

	// EventTypeSelect means that Some text is being selected.
	EventTypeSelect = EventType("select")

	// EventTypeWheel means that a wheel button of a pointing device is rotated in any direction.
	EventTypeWheel = EventType("wheel")

	// EventTypeDrag means that an element or text selection is being dragged (Fired continuously every 350ms).
	EventTypeDrag = EventType("drag")

	// EventTypeDragEnd means that a drag operation is being ended (by releasing a mouse button or hitting the escape key).
	EventTypeDragEnd = EventType("dragend")

	// EventTypeDragEnter means that a dragged element or text selection enters a valid drop target.
	EventTypeDragEnter = EventType("dragenter")

	// EventTypeDragStart means that the user starts dragging an element or text selection.
	EventTypeDragStart = EventType("dragstart")

	// EventTypeDragLeave means that a dragged element or text selection leaves a valid drop target.
	EventTypeDragLeave = EventType("dragleave")

	// EventTypeDragOver means that an element or text selection is being dragged over a valid drop target. (Fired continuously every 350ms.)
	EventTypeDragOver = EventType("dragover")

	// EventTypeDrop means that an element is dropped on a valid drop target.
	EventTypeDrop = EventType("drop")

	// EventTypeAudioProcess means that the input buffer of a ScriptProcessorNode is ready to be processed.
	EventTypeAudioProcess = EventType("audioprocess")

	// EventTypeCanPlay means that the browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
	EventTypeCanPlay = EventType("canplay")

	// EventTypeCanPlayThrough means that the browser estimates it can play the media up to its end without stopping for content buffering.
	EventTypeCanPlayThrough = EventType("canplaythrough")

	// EventTypeComplete means that the rendering of an OfflineAudioContext is terminated.
	EventTypeComplete = EventType("complete")

	// EventTypeDurationChange means that the duration attribute has been updated.
	EventTypeDurationChange = EventType("durationchange")

	// EventTypeEmptied means that the media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it.
	EventTypeEmptied = EventType("emptied")

	// EventTypeEnded means that Playback has stopped because the end of the media was reached.
	EventTypeEnded = EventType("ended")

	// EventTypeLoadedData means that the first frame of the media has finished loading.
	EventTypeLoadedData = EventType("loadeddata")

	// EventTypeLoadedMetadata means that the metadata has been loaded.
	EventTypeLoadedMetadata = EventType("loadedmetadata")

	// EventTypePause means that Playback has been paused.
	EventTypePause = EventType("pause")

	// EventTypePlay means that Playback has begun.
	EventTypePlay = EventType("play")

	// EventTypePlaying means that Playback is ready to start after having been paused or delayed due to lack of data.
	EventTypePlaying = EventType("playing")

	// EventTypeRateChange means that the playback rate has changed.
	EventTypeRateChange = EventType("ratechange")

	// EventTypeSeeked means that a seek operation completed.
	EventTypeSeeked = EventType("seeked")

	// EventTypeSeeking means that a seek operation began.
	EventTypeSeeking = EventType("seeking")

	// EventTypeStalled means that the user agent is trying to fetch media data, but data is unexpectedly not forthcoming.
	EventTypeStalled = EventType("stalled")

	// EventTypeSuspend means that Media data loading has been suspended.
	EventTypeSuspend = EventType("suspend")

	// EventTypeTimeUpdate means that the time indicated by the currentTime attribute has been updated.
	EventTypeTimeUpdate = EventType("timeupdate")

	// EventTypeVolumeChange means that the volume has changed.
	EventTypeVolumeChange = EventType("volumechange")

	// EventTypeWaiting means that Playback has stopped because of a temporary lack of data.
	EventTypeWaiting = EventType("waiting")

	// EventTypeLoadEnd means that Progress has stopped (after "error", "abort" or "load" have been dispatched).
	EventTypeLoadEnd = EventType("loadend")

	// EventTypeLoadStart means that Progress has begun.
	EventTypeLoadStart = EventType("loadstart")

	// EventTypeProgress means that In progress.
	EventTypeProgress = EventType("progress")

	// EventTypeTimeout means that Progression is terminated due to preset time expiring.
	EventTypeTimeout = EventType("timeout")
)
View Source
const (
	EditableTrue    = Editable("true")
	EditableFalse   = Editable("false")
	EditableInherit = Editable("inherit")
)
View Source
const (
	DirectionLTR  = Direction("ltr")
	DirectionRTL  = Direction("rtl")
	DirectionAuto = Direction("auto")
)
View Source
const (
	ELEMENT_NODE                = NodeType(1)
	ATTRIBUTE_NODE              = NodeType(2) // deprecated
	TEXT_NODE                   = NodeType(3)
	CDATA_SECTION_NODE          = NodeType(4)
	ENTITY_REFERENCE_NODE       = NodeType(5) // deprecated
	ENTITY_NODE                 = NodeType(6) // deprecated
	PROCESSING_INSTRUCTION_NODE = NodeType(7)
	COMMENT_NODE                = NodeType(8)
	DOCUMENT_NODE               = NodeType(9)
	DOCUMENT_TYPE_NODE          = NodeType(10)
	DOCUMENT_FRAGMENT_NODE      = NodeType(11)
	NOTATION_NODE               = NodeType(12) // deprecated
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Namespace string
	Name      string
	// contains filtered or unexported fields
}

func (Attribute) Exists

func (attr Attribute) Exists() bool

func (*Attribute) Get

func (attr *Attribute) Get() string

func (Attribute) Remove

func (attr Attribute) Remove()

func (Attribute) Set

func (attr Attribute) Set(value string)

func (Attribute) Toggle

func (attr Attribute) Toggle()

type Canvas

type Canvas struct {
	HTMLElement
}

Canvas provides properties and methods for manipulating the layout and presentation of <canvas> elements. https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement

func (Canvas) Context

func (element Canvas) Context(name string) canvas.Context

Context returns a drawing context on the canvas, or null if the context ID is not supported. A drawing context lets you draw on the canvas. https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext

func (Canvas) Context2D

func (element Canvas) Context2D() canvas.Context2D

Context2D returns 2D context to draw on canvas. https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext

func (Canvas) Height

func (element Canvas) Height() int

Height is the height of the <canvas> element interpreted in CSS pixels https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/height

func (Canvas) Width

func (element Canvas) Width() int

Width is the width of the <canvas> element interpreted in CSS pixels https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/width

type Class

type Class struct {
	// contains filtered or unexported fields
}

func (Class) Append

func (cls Class) Append(names ...string)

Add adds new class into `class` attribute

func (Class) Contains

func (cls Class) Contains(name string) bool

Contains returns true if `class` attribute contains given class

func (Class) Remove

func (cls Class) Remove(names ...string)

Remove removes class from classes list in `class` attribute

func (Class) Set

func (cls Class) Set(name string)

Set overwrites the whole `class` attribute

func (Class) String

func (cls Class) String() string

String returns `class` attribute

func (Class) Strings

func (cls Class) Strings() []string

Strings returns classes from `class` attribute

type Client

type Client struct {
	// contains filtered or unexported fields
}

func (Client) Height

func (client Client) Height() int

func (Client) Left

func (client Client) Left() int

func (Client) Top

func (client Client) Top() int

func (Client) Width

func (client Client) Width() int

type Console

type Console struct {
	Value
}

https://developer.mozilla.org/en-US/docs/Web/API/Console

func (Console) Debug

func (console Console) Debug(format string, args ...any)

https://developer.mozilla.org/en-US/docs/Web/API/Console/debug

func (Console) Error

func (console Console) Error(format string, args ...any)

https://developer.mozilla.org/en-US/docs/Web/API/Console/error

func (Console) Info

func (console Console) Info(format string, args ...any)

https://developer.mozilla.org/en-US/docs/Web/API/Console/info

func (Console) Log

func (console Console) Log(format string, args ...any)

https://developer.mozilla.org/en-US/docs/Web/API/Console/log

func (Console) Warning

func (console Console) Warning(format string, args ...any)

https://developer.mozilla.org/en-US/docs/Web/API/Console/warn

type Direction

type Direction string

type Document

type Document struct {
	Value
}

func (Document) Body

func (doc Document) Body() HTMLElement

Body returns the <body> or <frameset> node of the current document. https://developer.mozilla.org/en-US/docs/Web/API/Document/body

func (*Document) CharacterSet

func (doc *Document) CharacterSet() string

CharacterSet returns document's encoding. https://developer.mozilla.org/en-US/docs/Web/API/Document/characterSet

func (*Document) ContentType

func (doc *Document) ContentType() string

ContentType returns document's content type. https://developer.mozilla.org/en-US/docs/Web/API/Document/contentType

func (*Document) Cookie

func (doc *Document) Cookie() string

Cookie returns the HTTP cookies that apply to the Document. If there are no cookies or cookies can't be applied to this resource, the empty string will be returned.

func (Document) CreateCanvas

func (doc Document) CreateCanvas() Canvas

func (*Document) DesignMode

func (doc *Document) DesignMode() bool

DesignMode indicates whether the document can be edited. https://developer.mozilla.org/en-US/docs/Web/API/Document/designMode

func (*Document) Embeds

func (doc *Document) Embeds() []Embed

Embeds returns <object> and <embed> elements in the document. https://developer.mozilla.org/en-US/docs/Web/API/Document/embeds https://developer.mozilla.org/en-US/docs/Web/API/Document/plugins

func (*Document) Fullscreen

func (doc *Document) Fullscreen() Fullscreen

func (Document) HTML

func (doc Document) HTML() HTMLElement

HTML returns the Element that is a direct child of the document. For HTML documents, this is normally the <html> element. https://developer.mozilla.org/en-US/docs/Web/API/Document/head

func (Document) Head

func (doc Document) Head() HTMLElement

Head returns the <head> element of the current document.

func (*Document) Hidden

func (doc *Document) Hidden() bool

Hidden is true when the webpage is in the background and not visible to the user https://developer.mozilla.org/en-US/docs/Web/API/Document/hidden

func (*Document) Node

func (doc *Document) Node() Node

func (*Document) URL

func (doc *Document) URL() string

URL returns the URL for the current document. https://developer.mozilla.org/en-US/docs/Web/API/Document/URL

type Editable

type Editable string

type Element

type Element struct {
	Value
}

func (Element) AssignedSlot

func (el Element) AssignedSlot() Element

func (*Element) Attribute

func (el *Element) Attribute(name string) Attribute

func (*Element) Class

func (el *Element) Class() Class

func (*Element) Client

func (el *Element) Client() Client

func (*Element) ID

func (el *Element) ID() string

func (Element) InnerHTML

func (el Element) InnerHTML() string

func (*Element) LocalName

func (el *Element) LocalName() string

func (*Element) Matches

func (el *Element) Matches(selector string) bool

func (*Element) OuterHTML

func (el *Element) OuterHTML() string

func (*Element) ReleasePointerCapture

func (el *Element) ReleasePointerCapture(pointerID string)

func (*Element) RequestPointerLock

func (el *Element) RequestPointerLock()

func (*Element) Scroll

func (el *Element) Scroll() Scroll

func (*Element) ScrollBy

func (el *Element) ScrollBy(x, y int, smooth bool)

func (*Element) ScrollIntoView

func (el *Element) ScrollIntoView(smooth bool, block, inline string)

func (*Element) ScrollTo

func (el *Element) ScrollTo(x, y int, smooth bool)

func (Element) SetID

func (el Element) SetID(id string)

func (Element) SetInnerHTML

func (el Element) SetInnerHTML(html string)

func (*Element) SetPointerCapture

func (el *Element) SetPointerCapture(pointerID string)

func (Element) SetSlot

func (el Element) SetSlot(name string)

func (Element) Shadow

func (el Element) Shadow() ShadowDOM

func (Element) Slot

func (el Element) Slot() string

func (*Element) TagName

func (el *Element) TagName() string

type EventTarget

type EventTarget struct {
	Value
}

https://developer.mozilla.org/en-US/docs/Web/API/EventTarget

func (EventTarget) Listen

func (target EventTarget) Listen(event EventType, handler func(event Event))

Listen registers callback for the given event. https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener

type Fullscreen

type Fullscreen struct {
	// contains filtered or unexported fields
}

type HTMLElement

type HTMLElement struct {
	Element
}

https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement

func (*HTMLElement) Lang

func (el *HTMLElement) Lang() string

func (HTMLElement) SetHidden

func (el HTMLElement) SetHidden(value bool)

func (HTMLElement) SetLang

func (el HTMLElement) SetLang(value string)

type HTTPRequest added in v0.2.0

type HTTPRequest struct {
	Value
	// contains filtered or unexported fields
}

Object used to send HTTP requests. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/XMLHttpRequest

func (HTTPRequest) Abort added in v0.2.0

func (req HTTPRequest) Abort()

Abort aborts the request if it has already been sent. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/abort

func (HTTPRequest) Send added in v0.2.0

func (req HTTPRequest) Send(body []byte) HTTPResponse

Send the HTTP request. This operation is blocking on the Go side but doesn't block JS-side main thread. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send

func (HTTPRequest) SetHeader added in v0.2.0

func (req HTTPRequest) SetHeader(header, value string)

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader

func (HTTPRequest) SetTimeout added in v0.2.0

func (req HTTPRequest) SetTimeout(timeout time.Duration)

SetTimeout sets the time after which the request will be terminated. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout

func (HTTPRequest) SetWithCredentials added in v0.2.0

func (req HTTPRequest) SetWithCredentials(creds bool)

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials

func (HTTPRequest) Timeout added in v0.2.0

func (req HTTPRequest) Timeout() time.Duration

Timeout represents how long a request can take before automatically being terminated. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout

type HTTPResponse added in v0.2.0

type HTTPResponse struct {
	// contains filtered or unexported fields
}

func (HTTPResponse) Body added in v0.2.0

func (resp HTTPResponse) Body() []byte

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/response

func (HTTPResponse) Finished added in v0.2.0

func (resp HTTPResponse) Finished() bool

Finished indicates is the request is succesfully completed. It can be false if the request was aborted. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState

func (HTTPResponse) Headers added in v0.2.0

func (resp HTTPResponse) Headers() Headers

func (HTTPResponse) Status added in v0.2.0

func (resp HTTPResponse) Status() string

Always an empty string for HTTP/2 responses. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/statusText

func (HTTPResponse) StatusCode added in v0.2.0

func (resp HTTPResponse) StatusCode() int

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/status

type Node

type Node struct {
	// contains filtered or unexported fields
}

https://developer.mozilla.org/en-US/docs/Web/API/Node https://developer.mozilla.org/en-US/docs/Web/API/ParentNode

func (Node) BaseURI

func (node Node) BaseURI() string

Returns the base URL of the document containing the Node. https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI

func (Node) ChildrenCount

func (node Node) ChildrenCount() int

Returns the number of children of this Node which are elements. https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/childElementCount

func (Node) Clone

func (node Node) Clone(deep bool) Node

Clone a Node, and optionally, all of its contents. https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode

func (Node) Connected

func (node Node) Connected() bool

A boolean indicating whether or not the Node is connected (directly or indirectly) to the context object, e.g. the Document object in the case of the normal DOM, or the ShadowRoot in the case of a shadow DOM. https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected

func (Node) Content

func (node Node) Content() string

func (Node) Document

func (node Node) Document() Document

func (Node) Normalize

func (node Node) Normalize()

Clean up all the text nodes under this element (merge adjacent, remove empty). https://developer.mozilla.org/en-US/docs/Web/API/Node/normalize

func (Node) Remove

func (node Node) Remove() bool

Remove the node from the parent node.

func (Node) RemoveChildren

func (node Node) RemoveChildren()

Remove all children. https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild

func (Node) Type

func (node Node) Type() NodeType

Returns the type of the node. https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType

type NodeType

type NodeType int

type Offset

type Offset struct {
	// contains filtered or unexported fields
}

Incapsulates a set of offset-related properties. https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetLeft https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetTop https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth

func (*Offset) Height

func (offset *Offset) Height() int

Returns the height of an element, relative to the layout. https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight

func (*Offset) Left

func (offset *Offset) Left() int

Returns the distance from this element's left border to its Offset.Parent's left border. https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetLeft

func (*Offset) Parent

func (offset *Offset) Parent() Element

Returns an Element that is the element from which all offset calculations are currently computed. https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent

func (*Offset) Top

func (offset *Offset) Top() int

Returns the distance from this element's top border to its Offset.Parent's top border. https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetTop

func (*Offset) Width

func (offset *Offset) Width() int

Returns the width of an element, relative to the layout. https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth

type Promise

type Promise struct {
	Value
}

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

func (Promise) Catch

func (promise Promise) Catch(handler func(reason js.Value))

Register callback for error handling

func (Promise) Get

func (promise Promise) Get() (msg Value, err Value)

Blocking call that returns values of sucsess and error

func (Promise) Then

func (promise Promise) Then(handler func(value js.Value))

Register callback for sucsessful result handling

type Screen

type Screen struct {
	Value
}

https://developer.mozilla.org/en-US/docs/Web/API/Screen

func (Screen) AvailableHeight

func (screen Screen) AvailableHeight() int

Returns the height of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the Taskbar on Windows. https://developer.mozilla.org/en-US/docs/Web/API/Screen/availHeight

func (Screen) AvailableWidth

func (screen Screen) AvailableWidth() int

Returns the amount of horizontal space in pixels available to the window. https://developer.mozilla.org/en-US/docs/Web/API/Screen/availWidth

func (Screen) Height

func (screen Screen) Height() int

Returns the height of the screen in pixels. https://developer.mozilla.org/en-US/docs/Web/API/Screen/height

func (Screen) Width

func (screen Screen) Width() int

Returns the width of the screen. https://developer.mozilla.org/en-US/docs/Web/API/Screen/width

type Scroll

type Scroll struct {
	// contains filtered or unexported fields
}

func (Scroll) Height

func (scroll Scroll) Height() int

func (Scroll) Left

func (scroll Scroll) Left() int

func (Scroll) Top

func (scroll Scroll) Top() int

func (Scroll) Width

func (scroll Scroll) Width() int

type ShadowDOM

type ShadowDOM struct {
	// contains filtered or unexported fields
}

func (ShadowDOM) Attach

func (shadow ShadowDOM) Attach() Element

Attach attaches a shadow DOM tree to the specified element and returns ShadowRoot. We always create "open" shadow DOM because "closed" can't totally forbid access to the DOM and give falls feeling of protection. Read more: https://blog.revillweb.com/open-vs-closed-shadow-dom-9f3d7427d1af

func (ShadowDOM) Host

func (shadow ShadowDOM) Host() Element

Host returns a reference to the DOM element the ShadowRoot is attached to.

func (ShadowDOM) Root

func (shadow ShadowDOM) Root() Element

Root returns ShadowRoot hosted by the element.

type Value

type Value struct {
	js.Value
}

Value is an extended js.Value with more types support

func (Value) Call

func (v Value) Call(method string, args ...any) Value

Call calls the given method of the object.

func (Value) Canvas

func (v Value) Canvas() Canvas

Represents the current value into Canvas

func (Value) Element

func (v Value) Element() Element

Represents the current value into Element

func (Value) Embed

func (v Value) Embed() Embed

Represents the current value into Embed

func (Value) Event

func (v Value) Event() Event

Represents the current value into Event

func (Value) EventTarget

func (v Value) EventTarget() EventTarget

Represents the current value into EventTarget

func (Value) Get

func (v Value) Get(property string) Value

Get returns the given property of the value

func (Value) HTMLElement

func (v Value) HTMLElement() HTMLElement

Represents the current value into HTMLElement

func (Value) JSValue added in v0.3.0

func (v Value) JSValue() js.Value

Casts web.Value to js.Value

func (Value) MediaStream

func (v Value) MediaStream() audio.MediaStream

Represents the current value into audio.MediaStream

func (Value) New

func (v Value) New(args ...any) Value

Creates new instance of the JS class.

func (Value) Node

func (v Value) Node() Node

Represents the current value into Node

func (Value) OptionalString

func (v Value) OptionalString() string

OptionalString returns empty string if Value is null

func (Value) Promise

func (v Value) Promise() Promise

Represents the current value into Promise

func (Value) Strings

func (v Value) Strings() (items []string)

Represents the current value as slice of strings

func (*Value) Values

func (v *Value) Values() (items []Value)

Represents the current value as slice of values

type Window

type Window struct {
	Value
}

https://developer.mozilla.org/en-US/docs/Web/API/Window

func (Window) Event

func (window Window) Event() Event

Event returns the current event. The Event object passed directly to event handlers should be used instead whenever possible. https://developer.mozilla.org/en-US/docs/Web/API/Window/event

func (Window) HTTPRequest added in v0.2.0

func (window Window) HTTPRequest(method, url string) HTTPRequest

Create an object used to send HTTP requests (XMLHttpRequest), open it (initialize) and set the response type (responseType) to binary. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/XMLHttpRequest https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/open https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType

func (Window) InnerHeight

func (window Window) InnerHeight() int

Returns the height of the content area of the browser window including, if rendered, the horizontal scrollbar. https://developer.mozilla.org/en-US/docs/Web/API/Window/innerHeight

func (Window) InnerWidth

func (window Window) InnerWidth() int

Returns the width of the content area of the browser window including, if rendered, the vertical scrollbar. https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth

func (Window) Navigator

func (window Window) Navigator() Navigator

Navigator returns a reference to the Navigator object, which has methods and properties about the application running the script. https://developer.mozilla.org/en-US/docs/Web/API/Window/navigator https://developer.mozilla.org/en-US/docs/Web/API/Navigator

func (Window) OuterHeight

func (window Window) OuterHeight() int

Returns the height of the outside of the browser window. https://developer.mozilla.org/en-US/docs/Web/API/Window/outerHeight

func (Window) OuterWidth

func (window Window) OuterWidth() int

Returns the width of the outside of the browser window. https://developer.mozilla.org/en-US/docs/Web/API/Window/outerWidth

func (Window) RequestAnimationFrame

func (window Window) RequestAnimationFrame(handler func(), recursive bool)

https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY

func (Window) ScreenX

func (window Window) ScreenX() int

Returns the horizontal distance from the left border of the user's browser viewport to the left side of the screen. https://developer.mozilla.org/en-US/docs/Web/API/Window/screenX

func (Window) ScreenY

func (window Window) ScreenY() int

Returns the vertical distance from the top border of the user's browser viewport to the top side of the screen. https://developer.mozilla.org/en-US/docs/Web/API/Window/screenY

func (Window) ScrollX

func (window Window) ScrollX() int

Returns the number of pixels that the document has already been scrolled horizontally. https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX

func (Window) ScrollY

func (window Window) ScrollY() int

Returns the number of pixels that the document has already been scrolled vertically. https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY

Jump to

Keyboard shortcuts

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