-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a readme, missing build tags, fix old code; addresses #4
- Loading branch information
Denys Smirnov
committed
Sep 27, 2018
1 parent
893f96a
commit b1af1bc
Showing
11 changed files
with
79 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# 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. | ||
|
||
**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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//+build js | ||
|
||
package chrome | ||
|
||
import "github.com/dennwc/dom/js" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//+build wasm | ||
|
||
package js | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//+build wasm | ||
|
||
package js | ||
|
||
type Error struct { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//+build wasm | ||
|
||
package js | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package storage | ||
|
||
type Storage interface { | ||
// Length returns an integer representing the number of data items stored in the Storage object. | ||
Length() int | ||
// Key will return the name of the nth key in the storage. | ||
Key(ind int) string | ||
// GetItem will return that key's value. | ||
GetItem(key string) (string, bool) | ||
// SetItem will add that key to the storage, or update that key's value if it already exists. | ||
SetItem(key, val string) | ||
// RemoveItem will remove that key from the storage. | ||
RemoveItem(key string) | ||
// Clear will empty all keys out of the storage. | ||
Clear() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//+build wasm | ||
|
||
package svg | ||
|
||
import ( | ||
|