Documentation ¶
Overview ¶
The Gooroo package gathers a set of cumulative functions allowing you to create web applications on the Frontend side. To do this purpose, it implements DOM manipulation features based on syscall/js and webassembly. Its objective is to explore the possibilities of a modern, lightweight and javascript independent web library.
Index ¶
- func Css(filepath string)
- func Html(domComponents ...DomComponent)
- func Js(filepath string)
- func Render(context func())
- func UseCallback(callback func(...any) any, variables ...*any) *func(...any) any
- func UseEffect(callback func(), variables ...*any)
- func UseMemo(callback func() any, variables ...*any) any
- func UseState(initialValue any) (actualValue *any, f func(setterValue any))
- type DomComponent
- func A[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
- func Br() DomComponent
- func Button[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
- func ClassName(className string) DomComponent
- func Div(insiders ...DomComponent) DomComponent
- func FlexLayout(flow string, justify string, align string, gap string) DomComponent
- func For[T string | int | int32 | int64 | float32 | float64 | bool | any](elements []T, keyDomComponent func(i int) DomComponent) DomComponent
- func Form(insiders ...DomComponent) DomComponent
- func GridLayout[T string | int](columns T, rows T, gap string) DomComponent
- func H1[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
- func H2[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
- func H3[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
- func H4[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
- func Hr() DomComponent
- func Href(href string) DomComponent
- func I(insiders ...DomComponent) DomComponent
- func Id(id string) DomComponent
- func If(condition bool, insiders ...DomComponent) DomComponent
- func Img(insiders ...DomComponent) DomComponent
- func Input(insiders ...DomComponent) DomComponent
- func Li(insiders ...DomComponent) DomComponent
- func OnChange(value *any, callbacks ...func(js.Value)) DomComponent
- func OnClick(callbacks ...func(js.Value)) DomComponent
- func Option[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
- func P[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
- func Placeholder(placeholder string) DomComponent
- func Select(insiders ...DomComponent) DomComponent
- func Span[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
- func Src(src string) DomComponent
- func Style(style string) DomComponent
- func Table(insiders ...DomComponent) DomComponent
- func Td(insiders ...DomComponent) DomComponent
- func TextArea(insiders ...DomComponent) DomComponent
- func Th(insiders ...DomComponent) DomComponent
- func Title(title string) DomComponent
- func Tr(insiders ...DomComponent) DomComponent
- func Type(_type string) DomComponent
- func Ul(insiders ...DomComponent) DomComponent
- func Value(value string) DomComponent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Html ¶
func Html(domComponents ...DomComponent)
Triggers a rendering of the DOM, of all the DomComponents declared in parameters.
func Js ¶ added in v0.1.10
func Js(filepath string)
Hangs a Js file in the <head> content of the website.
func Render ¶
func Render(context func())
Starts the library's renderer. Allows to re-trigger the renderings when the state changes (with a UseSate variable for example), through the state channel. Must take a lambda function func() containing the call to Html() as parameter to execute a rendering context.
func UseCallback ¶
Pass an inline callback and an array of dependencies. useCallback will return a memoized version of the callback that only changes if one of the dependencies has changed.
func UseEffect ¶
func UseEffect(callback func(), variables ...*any)
Accepts a function that contains imperative, possibly effectful code. The default behavior for effects is to fire the effect after every completed render. That way an effect is always recreated if one of its variables changes (in variadics params).
func UseMemo ¶
Pass a “create” function and an array of dependencies. useMemo will only recompute the memoized value when one of the dependencies has changed. This optimization helps to avoid expensive calculations on every render.
func UseState ¶
Returns a stateful value, and a function to update it. During the initial render, the returned state (state) is the same as the value passed as the first argument (initialState). The setState function is used to update the state. It accepts a new state value and enqueues a re-render of the DOM.
Types ¶
type DomComponent ¶
type DomComponent func() string
DomComponent represents an element of the DOM. This element can be a tag, an attribute, a layout or even a binding. Most DomComponents can be nested within each other thanks to variadic parameters.
func A ¶
func A[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
Declare an html element with the <a> tag.
func Button ¶
func Button[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
Declare an html element with the <button> tag.
func ClassName ¶
func ClassName(className string) DomComponent
Declare an attribute of an html element with the value 'class='
func Div ¶
func Div(insiders ...DomComponent) DomComponent
Declare an html element with the <div> tag.
func FlexLayout ¶
func FlexLayout(flow string, justify string, align string, gap string) DomComponent
Declare une configuration CSS dans l'attribut d'un element html avec la valeur 'style=', de manière a paramettrer un 'display: flex'
func For ¶
func For[T string | int | int32 | int64 | float32 | float64 | bool | any](elements []T, keyDomComponent func(i int) DomComponent) DomComponent
Same operation as htmlDomComponent() but applies the function passed in parameter for the whole array. The "key" element is used to make the link with the elements within the function.
func Form ¶
func Form(insiders ...DomComponent) DomComponent
Declare an html element with the <form> tag.
func GridLayout ¶
func GridLayout[T string | int](columns T, rows T, gap string) DomComponent
Declare une configuration CSS dans l'attribut d'un element html avec la valeur 'style=', de manière a paramettrer un 'display: grid'
func H1 ¶
func H1[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
Declare an html element with the <h1> tag.
func H2 ¶
func H2[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
Declare an html element with the <h2> tag.
func H3 ¶
func H3[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
Declare an html element with the <h3> tag.
func H4 ¶
func H4[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
Declare an html element with the <h4> tag.
func Href ¶
func Href(href string) DomComponent
Declare an attribute of an html element with the value 'href='
func I ¶ added in v0.1.10
func I(insiders ...DomComponent) DomComponent
Declare an html element with the <i> tag.
func Id ¶
func Id(id string) DomComponent
Declare an attribute of an html element with the value 'id='
func If ¶
func If(condition bool, insiders ...DomComponent) DomComponent
Same function as htmlDomComponent() but only if the condition in parameter is valid.
func Img ¶
func Img(insiders ...DomComponent) DomComponent
Declare an html element with the <img> tag.
func Input ¶
func Input(insiders ...DomComponent) DomComponent
Declare an html element with the <input> tag.
func OnChange ¶
func OnChange(value *any, callbacks ...func(js.Value)) DomComponent
Declare a binding on the event 'change' on the attached element to trigger the function passed in parameter.
func OnClick ¶
func OnClick(callbacks ...func(js.Value)) DomComponent
Declare a binding on the event 'click' on the attached element to trigger the function passed in parameter.
func Option ¶
func Option[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
Declare an html element with the <option> tag.
func P ¶
func P[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
Declare an html element with the <p> tag.
func Placeholder ¶
func Placeholder(placeholder string) DomComponent
Declare an attribute of an html element with the value 'placeholder='
func Select ¶
func Select(insiders ...DomComponent) DomComponent
Declare an html element with the <select> tag.
func Span ¶
func Span[T string | int | int32 | int64 | float32 | float64 | bool](text T, insiders ...DomComponent) DomComponent
Declare an html element with the <span> tag.
func Src ¶
func Src(src string) DomComponent
Declare an attribute of an html element with the value 'src='
func Style ¶
func Style(style string) DomComponent
Declare an attribute of an html element with the value 'style='
func Table ¶
func Table(insiders ...DomComponent) DomComponent
Declare an html element with the <table> tag.
func TextArea ¶
func TextArea(insiders ...DomComponent) DomComponent
Declare an html element with the <textarea> tag.
func Title ¶
func Title(title string) DomComponent
Declare an attribute of an html element with the value 'title='
func Type ¶
func Type(_type string) DomComponent
Declare an attribute of an html element with the value 'type='
func Value ¶
func Value(value string) DomComponent
Declare an attribute of an html element with the value 'value='
Directories ¶
Path | Synopsis |
---|---|
It is an HTML, CSS, JS lexer to a set of Go constants.
|
It is an HTML, CSS, JS lexer to a set of Go constants. |
This package describes the private utility and generic functions to the other methods of the main gooroo package.
|
This package describes the private utility and generic functions to the other methods of the main gooroo package. |