gtml

package module
v0.0.0-...-a340c15 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 5 Imported by: 0

README

GTML (GolangText Markup Language)

golang reactive component frontend framwork using wasm

func Index(app *gtml.App) *gtml.App {
   return app.Use(
   	Div(
   		Style(
   			"background-color: cyan;",
   			"padding: 10px;",
   		),
   	)(
   		P()(
   			Text("Hello World")
   		),
   	),
   )
}

func main() {
   runtime.Runtime(
   	Index(
   		gtml.NewApp(),
   	),
   )
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Each

func Each(
	slice interface{},
) func(fn func(int, any) elements.Element) *elements.SliceEl

func Each2

func Each2[T any](
	slice []T,
) func(fn func(int, T) elements.Element) *elements.SliceEl

func For

func For(
	init, reached int,
) func(fn func(int) elements.Element) *elements.SliceEl

func If

func If(
	condition bool,
) func(el elements.Element) statement

NOTE: if there is no Else or Elif after, you should add .Value() after

Types

type App

type App struct {
	Element      elements.Element
	StateManager *StateManager
}

func NewApp

func NewApp() *App

func (*App) Use

func (a *App) Use(el elements.Element) *App

this function will be used to give App main element

func (*App) UseState

func (a *App) UseState(v interface{}) *State

type State

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

the state represents a reactive value in the main component

NOTE: id is used by the state manager in the runtime and when something is pushed through the channel, this data will be placed on value field

func (*State) Get

func (s *State) Get() interface{}

func (*State) Set

func (s *State) Set(v interface{})

type StateManager

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

func NewStateManager

func NewStateManager() *StateManager

func (*StateManager) Start

func (m *StateManager) Start()

func (*StateManager) Stop

func (m *StateManager) Stop()

Directories

Path Synopsis
example
app

Jump to

Keyboard shortcuts

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