wrappers

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2019 License: MIT Imports: 1 Imported by: 0

README

wrappers

Package contains wrappers of GopherJS calls

This Package do not contain dependencies of own types so gopherjs will build only used functions

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Window is a window js Object
	Window = js.Global
	// Document is a DOM of the page
	Document = js.Global.Get("document")
)

Functions

func AddEventListener

func AddEventListener(obj *js.Object, event string, listener func(event *js.Object), args ...interface{})

AddEventListener sets up a function that will be called whenever the specified event is delivered to the target

func AddEventListenerByClass

func AddEventListenerByClass(class string, event string, listener func(event *js.Object), args ...interface{})

AddEventListenerByClass adds listener to elements with class name

func AddEventListenerByID

func AddEventListenerByID(id string, event string, listener func(event *js.Object), args ...interface{})

AddEventListenerByID adds listener to element with ID

func AddEventListenerDOMContentLoaded

func AddEventListenerDOMContentLoaded(callback func())

AddEventListenerDOMContentLoaded calls func when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading

func AddEventListenerLoad

func AddEventListenerLoad(callback func())

AddEventListenerLoad is fired when the whole page has loaded, including all dependent resources such as stylesheets images.

func AddOnPopState

func AddOnPopState(callback func(event *js.Object))

AddOnPopState calls callback each time the active history entry changes between two history entries for the same document. HistoryPushState or HistoryReplaceState won't trigger AddOnPopState

func Alert

func Alert(s string)

Alert calls alert in JS

func AppendChild

func AppendChild(parent, node *js.Object)

AppendChild adds a node to the end of the list of children of a specified parent node

func AttributeRemove

func AttributeRemove(node *js.Object, attr string) *js.Object

AttributeRemove removes the attribute with the specified name

func AttributeSet

func AttributeSet(node *js.Object, attr string, value string) *js.Object

AttributeSet sets attribute and its value to the node

func AttributeSetNS

func AttributeSetNS(node *js.Object, namespace string, attr string, value string) *js.Object

AttributeSetNS sets attribute with name space and its value to the node

func ClassAddToList

func ClassAddToList(node *js.Object, class string) *js.Object

ClassAddToList adds class name to the class list of the node

func ClassRemoveFromList

func ClassRemoveFromList(node *js.Object, class string) *js.Object

ClassRemoveFromList removes class name from class list of the node

func ConsoleError

func ConsoleError(args ...interface{})

ConsoleError outputs an error message to the Web Console.

func ConsoleInfo

func ConsoleInfo(args ...interface{})

ConsoleInfo outputs an informational message to the Web Console.

func ConsoleLog

func ConsoleLog(args ...interface{})

ConsoleLog outputs a message to the Web Console.

func ConsoleWarn

func ConsoleWarn(args ...interface{})

ConsoleWarn outputs a warning message to the Web Console.

func CreateElement

func CreateElement(name string) *js.Object

CreateElement creates the HTML element specified by tagName

func CreateTextNode

func CreateTextNode(text string) *js.Object

CreateTextNode creates a new Text node

func DocumentSetTitle

func DocumentSetTitle(title string)

DocumentSetTitle sets title of the page

func GetAttribute

func GetAttribute(node *js.Object, attr string) string

GetAttribute returns value of the node attribute

func GetConsole

func GetConsole() *js.Object

GetConsole returns console

func GetElementByID

func GetElementByID(id string) *js.Object

GetElementByID returns element by ID

func GetElementsByClassName

func GetElementsByClassName(class string) []*js.Object

GetElementsByClassName returns list of the elements by class name

func GetHistory

func GetHistory() *js.Object

GetHistory returns history object

func GetLocation

func GetLocation() *js.Object

GetLocation returns location object

func GetQuerySelector

func GetQuerySelector(selector string) *js.Object

GetQuerySelector returns the first Element within the document that matches the specified selector, or group of selectors

func GetQuerySelectorAll

func GetQuerySelectorAll(selector string) *js.Object

GetQuerySelectorAll returns a static (not live) NodeList representing a list of the document's elements that match the specified group of selectors

func GetStateOfOnPopState

func GetStateOfOnPopState(event *js.Object) interface{}

GetStateOfOnPopState returns state of the event in callback onpopstate state sets in HistoryPushState or HistoryReplaceState methods

func GetTargetOfEventListener

func GetTargetOfEventListener(event *js.Object) *js.Object

GetTargetOfEventListener returns target of the event listener

func GetValueString

func GetValueString(node *js.Object) string

GetValueString returns string value of the js Node

func HistoryPushState

func HistoryPushState(state interface{}, url string)

HistoryPushState will cause the URL bar to display URL, but won't cause the browser to load URL or even check that URL exists. The parameter Title is ignored by browsers and is not taken here as an argument.

func HistoryReplaceState

func HistoryReplaceState(state interface{}, url string)

HistoryReplaceState operates exactly like HistoryPushState except that it modifies the current history entry instead of creating a new one. The parameter Title is ignored by browsers and is not taken here as an argument.

func LocationGetHash

func LocationGetHash() string

LocationGetHash returns string containing a '#' followed by the fragment identifier of the URL.

func LocationGetHost

func LocationGetHost() string

LocationGetHost returns string containing the host, that is the hostname, a ':', and the port of the URL.

func LocationGetHostname

func LocationGetHostname() string

LocationGetHostname returns string containing the domain of the URL

func LocationGetHref

func LocationGetHref() string

LocationGetHref returns string containing the entire URL

func LocationGetOrigin

func LocationGetOrigin() string

LocationGetOrigin returns string containing the canonical form of the origin of the specific location.

func LocationGetPathname

func LocationGetPathname() string

LocationGetPathname returns string containing an initial '/' followed by the path of the URL.

func LocationGetPort

func LocationGetPort() string

LocationGetPort returns string containing the port number of the URL

func LocationGetProtocol

func LocationGetProtocol() string

LocationGetProtocol returns string containing the protocol scheme of the URL including the final ':', example 'http:' or 'https:'

func LocationGetSearch

func LocationGetSearch() string

LocationGetSearch returns string containing a '?' followed by the parameters or "querystring" of the URL.

func LocationReload

func LocationReload(forcedReload ...bool)

LocationReload reloads the current resource, like the Refresh button. It has an optional Boolean parameter, which is false by default. If true, the page is always reloaded from the server, ignoring the browser cache.

func LocationSetHref

func LocationSetHref(href string)

LocationSetHref sets href and associated document navigates to the new page

func NewURL

func NewURL(url string) *js.Object

NewURL creates new url object

func RemoveAllChild

func RemoveAllChild(node *js.Object)

RemoveAllChild remove every child of the node

func RemoveChild

func RemoveChild(parent, node *js.Object)

RemoveChild removes a child node from the DOM

func RemoveEventListener

func RemoveEventListener(obj *js.Object, event string, listener func(event *js.Object), args ...interface{})

RemoveEventListener removes from the element an event listener previously registered with addEventListener

func RemoveEventListenerByClass

func RemoveEventListenerByClass(class string, event string, listener func(event *js.Object), args ...interface{})

RemoveEventListenerByClass removes listener from elements with class name

func RemoveEventListenerByID

func RemoveEventListenerByID(id string, event string, listener func(event *js.Object), args ...interface{})

RemoveEventListenerByID removes listener from element with ID

func SetValueString

func SetValueString(node *js.Object, value string)

SetValueString sets string value to attribute of the node

func TextContentGet

func TextContentGet(node *js.Object) string

TextContentGet returns text content of the node

func TextContentSet

func TextContentSet(node *js.Object, text string) *js.Object

TextContentSet sets text content of the node

func URLAppendQueryParam

func URLAppendQueryParam(param string, value string)

URLAppendQueryParam appends Query Param to current URL

func URLSearchParamsGet

func URLSearchParamsGet(param string) string

URLSearchParamsGet returns value of the param of the current URL

Types

This section is empty.

Jump to

Keyboard shortcuts

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