component

package
v0.0.0-...-89dfdfc Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ASSET = "/vendor/evoli/static/component.js"
View Source
const ENDPOINT = "/internal/component"
View Source
const MOUNT = "Mount"
View Source
const UPDATE = "Update"

Variables

This section is empty.

Functions

func GetRegisterComponentsCount

func GetRegisterComponentsCount() int

func HandleRouterRequest

func HandleRouterRequest(request *router.Request) any

func Register

func Register(component Component)

func RegisterRoutes

func RegisterRoutes(r *router.Router)

func SetupViewEngine

func SetupViewEngine(engine *view.Engine)

func ValidateRequest

func ValidateRequest(request *Request) bool

Types

type Base

type Base struct {
	Id        string
	File      string
	Component *use.Reflection
	Data      *use.Collection[string, interface{}]
}

func New

func New(componentStruct any, data map[string]any) *Base

func NewByName

func NewByName(name string, data map[string]any) *Base

func NewByNameWithData

func NewByNameWithData(name string, data string) *Base

func (*Base) Call

func (b *Base) Call(method string, parameters interface{}) interface{}

func (*Base) Get

func (b *Base) Get(key string) interface{}

func (*Base) GetCid

func (b *Base) GetCid() string

func (*Base) GetComponentName

func (b *Base) GetComponentName() string

func (*Base) GetData

func (b *Base) GetData() map[string]any

func (*Base) GetFilePath

func (b *Base) GetFilePath() string

func (*Base) GetRawContent

func (b *Base) GetRawContent() string

func (*Base) GetState

func (b *Base) GetState() map[string]interface{}

func (*Base) Render

func (b *Base) Render() string

func (*Base) RenderParsed

func (b *Base) RenderParsed() string

func (*Base) Set

func (b *Base) Set(data map[string]interface{})

func (*Base) Trigger

func (b *Base) Trigger(args ...any)

type Component

type Component interface {
}

type Data

type Data struct {
	Name string `json:"name"`
}

type Methods

type Methods struct{}

func (*Methods) Include

func (c *Methods) Include(name string, arg ...any) (string, error)

type Request

type Request struct {
	Id         string         `json:"_id"`
	Component  string         `json:"component"`
	Method     string         `json:"method"`
	State      map[string]any `json:"state"`
	Action     string         `json:"action"`
	Parameters []any          `json:"parameters"`
}

type Response

type Response struct {
	Id        string         `json:"_id"`
	Component string         `json:"component"`
	State     map[string]any `json:"state"`
	Type      string         `json:"type"`
	Content   string         `json:"content"`
	Response  any            `json:"response"`
}

func Handle

func Handle(request *Request) *Response

Jump to

Keyboard shortcuts

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