dom

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: Apache-2.0 Imports: 0 Imported by: 19

README

Go DOM binding (and more) for WebAssembly

This library provides a Go API for different Web APIs for WebAssembly target.

It's in an active development, but an API will be carefully versioned to avoid breaking users. Use Go dependency management tools to lock a specific version.

More information about Go's WebAssembly support can be found on Go's WebAssembly wiki page.

Features:

  • Better JS API (wrappers for syscall/js)
  • Basic DOM manipulation, styles, events
  • Input elements
  • SVG elements and transforms
  • LocalStorage and SessionStorage
  • Extension APIs (tested on Chrome):
    • Native Messaging
    • Bookmarks
    • Tabs
  • net-like library for WebSockets
    • Tested with gRPC
  • wasm-server for fast prototyping

Quickstart

Pull the library and install wasm-server (optional):

go get -u github.com/dennwc/dom
go install github.com/dennwc/dom/cmd/wasm-server

Run an example app:

cd $GOPATH/src/github.com/dennwc/dom
wasm-server

Check result: http://localhost:8080/

The source code is recompiled on each page refresh, so feel free to experiment!

Similar Projects

Editor Configuration

If you are using Visual Studio Code, you can use workspace settings to configure the environment variables for the go tools.

Your settings.json file should look something like this:

{
    "go.toolsEnvVars": { "GOARCH": "wasm", "GOOS": "js" }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color string

Directories

Path Synopsis
cmd
app
examples module
extension
chrome/native
Package native provides an API for Native Messaging for Chrome extensions.
Package native provides an API for Native Messaging for Chrome extensions.
internal
js
Package JS provides additional functionality on top of syscall/js package for WASM.
Package JS provides additional functionality on top of syscall/js package for WASM.
net
ws
Package ws provides a functionality similar to Go net package on top of WebSockets.
Package ws provides a functionality similar to Go net package on top of WebSockets.

Jump to

Keyboard shortcuts

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