js

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: MIT Imports: 2 Imported by: 0

README

Dairaga JS (Experimental)

It is a experimental toolkit about GO Webassembly with GO 1.13. Therefore, it is incompatible with 1.11 and before.

Packages

js

JS wraps javascript global objects, like window, document, Event, EventTarget, and Error.

dom
bs

BS is a Bootstrap toolkit warps base component and utilities.

  • alert
  • badge
  • button
  • card
  • flex
  • list
  • modal: It is a Bootstrap Modal component.
  • progress
  • spinner
  • table
  • toast
io

It wraps javascript File and FileReader.

media

It wraps javascript Audio API, like AudioContext, MediaStream, AudioBuffer and AudioNode.

  • recorder: It is a recording tool.
storage
url
websocket

It wraps javascript WebSocket.

xhr

It wraps javascipt XMLHttpRequest and provides API and methods like GO net/http.

Documentation

Rendered for js/wasm

Overview

Package js a experimental toolkit about Go Webassembly with Go 1.12. Therefore, it is incompatible with 1.11 and before. It includes some common javascript functions, DOM, File, FileReader, Recorder with Web Audio API, WebSocket API, XHTTPRequest and Bootstrap (4) toolkit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert

func Alert(a ...interface{})

Alert invokes window.alert function.

func Alertf

func Alertf(format string, a ...interface{})

Alertf invokes window.alert function.

func Bytes

func Bytes(arrayBuffer Value) []byte

Bytes convert javascript array buffer to Go byte slice.

func Confirm

func Confirm(a ...interface{}) bool

Confirm invokes window.confirm function.

func Confirmf

func Confirmf(format string, a ...interface{}) bool

Confirmf invokes window.confirm function.

func IsNaN

func IsNaN(v js.Value) bool

IsNaN ...

func IsUndefined

func IsUndefined(v js.Value) bool

IsUndefined ...

func ParseFloat

func ParseFloat(val string) (float64, bool)

ParseFloat ...

func ParseInt

func ParseInt(val string, radix int) (int, bool)

ParseInt ...

func RegisterFunc

func RegisterFunc(name string, fn Func)

RegisterFunc ...

func RegisterValue

func RegisterValue(name string, val Value)

RegisterValue ...

func ToGoBytes

func ToGoBytes(uint8Array Value) []byte

ToGoBytes copy javascript uint8Array content to go bytes.

func TypedArrayOf

func TypedArrayOf(x interface{}) js.Value

TypedArrayOf return a javascript typed array. x must be must be []int8, []int16, []int32, []uint8, []uint16, []uint32, []float32 and []float64.

Types

type Error

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

Error represents javascript error object.

func ErrorOf

func ErrorOf(x Value) *Error

ErrorOf returns a error object.

func (*Error) Error

func (err *Error) Error() string

func (*Error) JSValue

func (err *Error) JSValue() Value

JSValue ...

type Event

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

Event represents javascript Event. https://developer.mozilla.org/en-US/docs/Web/API/Event

func EventOf

func EventOf(x Value) *Event

EventOf returns event.

func (*Event) JSValue

func (e *Event) JSValue() Value

JSValue ...

func (*Event) String

func (e *Event) String() string

type EventTarget

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

EventTarget represents javascript EventTarget.

func EventTargetOf

func EventTargetOf(v Value) *EventTarget

EventTargetOf returns a event target object.

func (*EventTarget) AddEventListener

func (e *EventTarget) AddEventListener(event string, cb Func) *EventTarget

AddEventListener adds callback for some event.

func (*EventTarget) JSValue

func (e *EventTarget) JSValue() Value

JSValue ...

func (*EventTarget) Register

func (e *EventTarget) Register(event string, cb Func) *EventTarget

Register ...

func (*EventTarget) Release

func (e *EventTarget) Release()

Release frees up resoruces if the object is not used anymore.

type Func

type Func = js.Func

Func alias syscall/js.Func

func FuncOf

func FuncOf(fn func(js.Value, []js.Value) interface{}) Func

FuncOf ...

type Value

type Value = js.Value

Value alias syscall/js.Value

func Call

func Call(fn string, args ...interface{}) Value

Call invoke a global function.

func Get

func Get(name string) Value

Get ...

func Global

func Global() Value

Global returns javascript global.

func New

func New(constructor string, args ...interface{}) Value

New returns a javascript object.

func ToJSUint8Array

func ToJSUint8Array(src []byte) Value

ToJSUint8Array copy go bytes to javascript uint8Array

func ValueOf

func ValueOf(x interface{}) Value

ValueOf ...

func Window

func Window() Value

Window ...

Directories

Path Synopsis
dom
Package dom is wraps HTMLElement.
Package dom is wraps HTMLElement.
bs
Package bs is a Bootstrap toolkit.
Package bs is a Bootstrap toolkit.
bs/alert
Package alert wraps Bootstrap Alert component
Package alert wraps Bootstrap Alert component
bs/badge
Package badge wraps Bootstrap Badge component
Package badge wraps Bootstrap Badge component
bs/button
Package button wraps Bootstrap Button component.
Package button wraps Bootstrap Button component.
bs/card
Package card wraps Bootstrap Card component.
Package card wraps Bootstrap Card component.
bs/list
Package list wraps Bootstrap List Group component.
Package list wraps Bootstrap List Group component.
bs/modal
Package modal wraps Bootstrap Modal component.
Package modal wraps Bootstrap Modal component.
bs/progress
Package progress wraps Bootstrap Progress component.
Package progress wraps Bootstrap Progress component.
bs/spinner
Package spinner wraps Bootstrap spinner component.
Package spinner wraps Bootstrap spinner component.
bs/table
Package table wraps Bootstrap default Table Content.
Package table wraps Bootstrap default Table Content.
wav
Package url wraps javascript url object and funcions.
Package url wraps javascript url object and funcions.

Jump to

Keyboard shortcuts

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