Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enimatek-nl/tango
WebAssembly Lightweight Javascript Framework in Go (React / AngularJS Inspired)
https://github.com/enimatek-nl/tango
Last synced: 3 months ago
JSON representation
WebAssembly Lightweight Javascript Framework in Go (React / AngularJS Inspired)
- Host: GitHub
- URL: https://github.com/enimatek-nl/tango
- Owner: enimatek-nl
- Created: 2021-10-19T06:13:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-24T19:58:19.000Z (about 3 years ago)
- Last Synced: 2024-08-01T13:28:57.536Z (6 months ago)
- Language: Go
- Homepage:
- Size: 95.7 KB
- Stars: 12
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-ccamel - enimatek-nl/tango - WebAssembly Lightweight Javascript Framework in Go (React / AngularJS Inspired) (Go)
README
# Tango
_Lightweight WASM HTML / Javascript Framework_### Intro
WebAssembly is nice, Go on the web is nice, so I ported [Tangu](https://github.com/enimatek-nl/tangu/) to Go and
WebAssembly.Tangu is an AngularJS inspired project I started a while back to explore [nim](https://nim-lang.org).
Where Tangu is nim 100% transpiled Javascript, Tango is golang compiled to WASM.
### Usage
`GOOS=js GOARCH=wasm go get github.com/enimatek-nl/tango`
### Get Started
```go
func main() {tg := tango.New()
tg.AddComponents(
std.Router{},
std.Repeat{},
std.Click{},
std.Bind{},
std.Change{},
std.Model{},
std.Attr{})
tg.AddRoute(tango.NewRoute("/", &ViewController{Hello: "hello?"}))
tg.Bootstrap()}
``````go
type ViewController struct {
Hello string `tng:"hello"`
ClickMe tango.SFunc `tng:"clickme"`
}func (v ViewController) Config() tango.ComponentConfig {
return tango.ComponentConfig{
Name: "ViewController",
Kind: tango.Controller,
Scoped: false,
}
}func (v *ViewController) Constructor(tng tango.Hook) bool {
v.ClickMe = func(self *tango.Tango, this js.Value, local *tango.Scope) {
v.Hello = "world!"
tng.Digest(v)
}return true
}func (v ViewController) Render() string {
return `
click me!
`
}func (v ViewController) AfterRender(tng tango.Hook) bool {
return false
}
```### How to use this Web Framework (SPA) & Backend API as a single project?
Check out this [todo example project](https://github.com/enimatek-nl/tango-example) as a reference implementation including Makefile and project structure._This project is a WIP..._