Git Product home page Git Product logo

tango's Introduction

Tango

Lightweight WASM HTML / Javascript Framework

Intro

WebAssembly is nice, Go on the web is nice, so I ported Tangu to Go and WebAssembly.

Tangu is an AngularJS inspired project I started a while back to explore nim.

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

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()

}
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 `
        <div>
            <p tng-bind="hello"></p>
            <button tng-click="clickme">click me!</button>
        </div>
    `
}

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 as a reference implementation including Makefile and project structure.

This project is a WIP...

tango's People

Contributors

enimatek-nl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.