modulepackage
0.0.0-20220213072331-dae427612c13
Repository: https://github.com/zrcoder/app.git
Documentation: pkg.go.dev
# README
app
Write web app in Go/Go+
A wrap of https://github.com/maxence-charriere/go-app, a little modify to adapt Go+.
Tutorials
# Functions
A returns an HTML element that defines a hyperlink.
Abbr returns an HTML element that defines an abbreviation or an acronym.
Address returns an HTML element that defines contact information for the author/owner of a document.
AppendClass adds c to the given class string.
Area returns an HTML element that defines an area inside an image-map.
Article returns an HTML element that defines an article.
Aside returns an HTML element that defines content aside from the page content.
Audio returns an HTML element that defines sound content.
B returns an HTML element that defines bold text.
Base returns an HTML element that specifies the base URL/target for all relative URLs in a document.
Bdi returns an HTML element that isolates a part of text that might be formatted in a different direction from other text outside it.
Bdo returns an HTML element that overrides the current text direction.
Blockquote returns an HTML element that defines a section that is quoted from another source.
Body returns an HTML element that defines the document's body.
Br returns an HTML element that defines a single line break.
Broadcast is a state option that broadcasts a state to other browser tabs and windows from the same origin.
Button returns an HTML element that defines a clickable button.
Canvas returns an HTML element that is used to draw graphics on the fly.
Caption returns an HTML element that defines a table caption.
Cite returns an HTML element that defines the title of a work.
Code returns an HTML element that defines a piece of computer code.
Col returns an HTML element that specifies column properties for each column within a colgroup element.
ColGroup returns an HTML element that specifies a group of one or more columns in a table for formatting.
CopyBytesToGo copies bytes from the Uint8Array src to dst.
CopyBytesToJS copies bytes from src to the Uint8Array dst.
CustomProvider returns a resource provider that serves static resources from a local directory located at the given path and prefixes URL paths with the given prefix.
Data returns an HTML element that links the given content with a machine-readable translation.
DataList returns an HTML element that specifies a list of pre-defined options for input controls.
Dd returns an HTML element that defines a description/value of a term in a description list.
Del returns an HTML element that defines text that has been deleted from a document.
Details returns an HTML element that defines additional details that the user can view or hide.
Dfn returns an HTML element that represents the defining instance of a term.
Dialog returns an HTML element that defines a dialog box or window.
Div returns an HTML element that defines a section in a document.
Dl returns an HTML element that defines a description list.
Dt returns an HTML element that defines a term/name in a description list.
Em returns an HTML element that defines emphasized text.
Embed returns an HTML element that defines a container for an external (non-HTML) application.
Encrypt is a state option that encrypts a state before persisting it in local storage.
ExpiresAt returns a state option that sets a state value to its zero value at the given time.
ExpiresIn returns a state option that sets a state value to its zero value after the given duration.
FieldSet returns an HTML element that groups related elements in a form.
FigCaption returns an HTML element that defines a caption for a figure element.
Figure returns an HTML element that specifies self-contained content.
FilterUIElems returns a filtered version of the given UI elements where selector elements such as If and Range are interpreted and removed.
Footer returns an HTML element that defines a footer for a document or section.
Form returns an HTML element that defines an HTML form for user input.
FuncOf returns a wrapped function.
GenerateStaticWebsite generates the files to run a PWA built with go-app as a static website in the specified directory.
Getenv retrieves the value of the environment variable named by the key.
GitHubPages returns a resource provider that provides resources from GitHub pages.
H1 returns an HTML element that defines HTML heading.
H2 returns an HTML element that defines HTML heading.
H3 returns an HTML element that defines HTML heading.
H4 returns an HTML element that defines HTML heading.
H5 returns an HTML element that defines HTML heading.
H6 returns an HTML element that defines HTML heading.
Handle registers the handler for the given action name.
Head returns an HTML element that defines information about the document.
Header returns an HTML element that defines a header for a document or section.
Hr returns an HTML element that defines a thematic change in the content.
Html returns an HTML element that defines the root of an HTML document.
HTMLString return an HTML string representation of the given UI element.
HTMLStringWithIndent return an indented HTML string representation of the given UI element.
I returns an HTML element that defines a part of text in an alternate voice or mood.
If returns a condition that filters the given elements according to the given expression.
IFrame returns an HTML element that defines an inline frame.
Img returns an HTML element that defines an image.
Input returns an HTML element that defines an input control.
Ins returns an HTML element that defines a text that has been inserted into a document.
Kbd returns an HTML element that defines keyboard input.
KeepBodyClean prevents third-party Javascript libraries to add nodes to the body element.
Label returns an HTML element that defines a label for an input element.
Legend returns an HTML element that defines a caption for a fieldset element.
Li returns an HTML element that defines a list item.
Link returns an HTML element that defines the relationship between a document and an external resource (most used to link to style sheets).
LocalDir returns a resource provider that serves static resources from a local directory located at the given path.
Main returns an HTML element that specifies the main content of a document.
Map returns an HTML element that defines a client-side image-map.
Mark returns an HTML element that defines marked/highlighted text.
Meta returns an HTML element that .
Meter returns an HTML element that defines a scalar measurement within a known range (a gauge).
Nav returns an HTML element that defines navigation links.
NewClientTester creates a testing dispatcher that simulates a client environment.
NewPreRenderLRUCache creates an in memory LRU cache that stores items for the given duration.
NewServerTester creates a testing dispatcher that simulates a client environment.
NoScript returns an HTML element that defines an alternate content for users that do not support client-side scripts.
Null returns the JavaScript value "null".
Object returns an HTML element that defines an embedded object.
Ol returns an HTML element that defines an ordered list.
OptGroup returns an HTML element that defines a group of related options in a drop-down list.
Option returns an HTML element that defines an option in a drop-down list.
Output returns an HTML element that .
P returns an HTML element that defines a paragraph.
Param returns an HTML element that defines a parameter for an object.
Persist is a state option that persists a state in local storage.
Picture returns an HTML element that defines a container for multiple image resources.
Pre returns an HTML element that defines preformatted text.
PrintHTML writes an HTML representation of the UI element into the given writer.
PrintHTMLWithIndent writes an idented HTML representation of the UI element into the given writer.
Progress returns an HTML element that represents the progress of a task.
Q returns an HTML element that defines a short quotation.
Range returns a range loop that iterates within the given source.
Raw returns a ui element from the given raw value.
RemoteBucket returns a resource provider that provides resources from a remote bucket such as Amazon S3 or Google Cloud Storage.
Route associates the type of the given component to the given path.
RouteWithRegexp associates the type of the given component to the given regular expression pattern.
Rp returns an HTML element that defines what to show in browsers that do not support ruby annotations.
Rt returns an HTML element that defines an explanation/pronunciation of characters (for East Asian typography).
Ruby returns an HTML element that defines a ruby annotation (for East Asian typography).
RunWhenOnBrowser starts the app, displaying the component associated with the current URL path.
S returns an HTML element that Defines text that is no longer correct.
Samp returns an HTML element that defines sample output from a computer program.
Script returns an HTML element that defines a client-side script.
Section returns an HTML element that defines a section in a document.
Select returns an HTML element that defines a drop-down list.
Small returns an HTML element that defines smaller text.
Source returns an HTML element that .
Span returns an HTML element that defines a section in a document.
Strong returns an HTML element that defines important text.
Style returns an HTML element that defines style information for a document.
Sub returns an HTML element that defines subscripted text.
Summary returns an HTML element that defines a visible heading for a details element.
Sup returns an HTML element that defines superscripted text.
T creates a tag with the given name and value.
Table returns an HTML element that defines a table.
TBody returns an HTML element that groups the body content in a table.
Td returns an HTML element that defines a cell in a table.
Template returns an HTML element that defines a template.
TestMatch looks for the element targeted by the descriptor in the given tree and reports whether it matches with the expected element.
TestPath is a helper function that returns a path to use in a TestUIDescriptor.
Text creates a simple text element.
Textarea returns an HTML element that defines a multiline input control (text area).
TFoot returns an HTML element that groups the footer content in a table.
Th returns an HTML element that defines a header cell in a table.
THead returns an HTML element that groups the header content in a table.
Time returns an HTML element that defines a date/time.
Title returns an HTML element that defines a title for the document.
Tr returns an HTML element that defines a row in a table.
U returns an HTML element that defines text that should be stylistically different from normal text.
Ul returns an HTML element that defines an unordered list.
Undefined returns the JavaScript value "undefined".
ValueOf returns x as a JavaScript value:
| Go | JavaScript | | ---------------------- | ---------------------- | | js.Value | [its value] | | js.Func | function | | nil | null | | bool | boolean | | integers and floats | number | | string | string | | []interface{} | new array | | map[string]interface{} | new object |
Panics if x is not one of the expected types.
ValueTo returns an EventHandler which stores the value of the DOM element (if exists) that emitted an event into the given value.
Var returns an HTML element that defines a variable.
Video returns an HTML element that defines a video or movie.
Wbr returns an HTML element that defines a possible line-break.
Window returns the JavaScript "window" object.
# Constants
Component represents a customized, independent and reusable UI element.
A dispatch mode that schedules the dispatched operation to be executed after the current update frame.
HTML represents an HTML element.
IsClient reports whether the code is running as a client in the WebAssembly binary (app.wasm).
IsServer reports whether the code is running on a server for pre-rendering purposes.
A dispatch mode where the dispatched operation is enqueued to be executed as soon as possible.
RawHTML represents an HTML element obtained from a raw HTML code snippet.
Selector represents an element that is used to select a subset of elements within a given list.
SimpleText represents a simple text element.
Constants that enumerates the JavaScript types.
Constants that enumerates the JavaScript types.
Constants that enumerates the JavaScript types.
Constants that enumerates the JavaScript types.
Constants that enumerates the JavaScript types.
Constants that enumerates the JavaScript types.
Constants that enumerates the JavaScript types.
Constants that enumerates the JavaScript types.
UndefinedElem represents an undefined UI element.
A dispatch mode where the dispatched operation is enqueued to be executed as soon as possible and its associated UI element is updated at the end of the current update cycle.
# Variables
NotFound is the ui element that is displayed when a request is not routed.
# Structs
Action represents a custom event that can be propagated across the app.
Compo represents the base struct to use in order to build a component.
Dispatch represents an operation executed on the UI goroutine.
Event is the interface that describes a javascript event.
Handler is an HTTP handler that serves an HTML page that loads a Go wasm app and its resources.
Icon describes a square image that is used in various places such as application icon, favicon or loading icon.
PreRenderedItem represent an item that is stored in a PreRenderCache.
ProxyResource is a proxy descriptor that maps a given resource to an URL path.
A state represents an observable value available across the app.
Tag is a key-value pair that adds context to an action.
TestUIDescriptor represents a descriptor that describes a UI element and its location from its parents.
# Interfaces
AppInstaller is the interface that describes a component that is notified when the application installation state changes.
AppUpdater is the interface that describes a component that is notified when the application is updated.
BrowserStorage is the interface that describes a web browser storage.
BrowserWindow is the interface that describes the browser window.
ClientDispatcher is the interface that describes a dispatcher that emulates a client environment.
Composer is the interface that describes a customized, independent and reusable UI element.
Condition represents a control structure that displays nodes depending on a given expression.
Context is the interface that describes a context tied to a UI element.
Dismounter is the interface that describes a component that can perform additional actions when dismounted.
Dispatcher is the interface that describes an environment that synchronizes UI instructions and UI elements lifecycle.
Func is the interface that describes a wrapped Go function to be called by JavaScript.
HTMLA is the interface that describes a <a> HTML element.
HTMLAbbr is the interface that describes a <abbr> HTML element.
HTMLAddress is the interface that describes a <address> HTML element.
HTMLArea is the interface that describes a <area> HTML element.
HTMLArticle is the interface that describes a <article> HTML element.
HTMLAside is the interface that describes a <aside> HTML element.
HTMLAudio is the interface that describes a <audio> HTML element.
HTMLB is the interface that describes a <b> HTML element.
HTMLBase is the interface that describes a <base> HTML element.
HTMLBdi is the interface that describes a <bdi> HTML element.
HTMLBdo is the interface that describes a <bdo> HTML element.
HTMLBlockquote is the interface that describes a <blockquote> HTML element.
HTMLBody is the interface that describes a <body> HTML element.
HTMLBr is the interface that describes a <br> HTML element.
HTMLButton is the interface that describes a <button> HTML element.
HTMLCanvas is the interface that describes a <canvas> HTML element.
HTMLCaption is the interface that describes a <caption> HTML element.
HTMLCite is the interface that describes a <cite> HTML element.
HTMLCode is the interface that describes a <code> HTML element.
HTMLCol is the interface that describes a <col> HTML element.
HTMLColGroup is the interface that describes a <colgroup> HTML element.
HTMLData is the interface that describes a <data> HTML element.
HTMLDataList is the interface that describes a <datalist> HTML element.
HTMLDd is the interface that describes a <dd> HTML element.
HTMLDel is the interface that describes a <del> HTML element.
HTMLDetails is the interface that describes a <details> HTML element.
HTMLDfn is the interface that describes a <dfn> HTML element.
HTMLDialog is the interface that describes a <dialog> HTML element.
HTMLDiv is the interface that describes a <div> HTML element.
HTMLDl is the interface that describes a <dl> HTML element.
HTMLDt is the interface that describes a <dt> HTML element.
HTMLEm is the interface that describes a <em> HTML element.
HTMLEmbed is the interface that describes a <embed> HTML element.
HTMLFieldSet is the interface that describes a <fieldset> HTML element.
HTMLFigCaption is the interface that describes a <figcaption> HTML element.
HTMLFigure is the interface that describes a <figure> HTML element.
HTMLFooter is the interface that describes a <footer> HTML element.
HTMLForm is the interface that describes a <form> HTML element.
HTMLH1 is the interface that describes a <h1> HTML element.
HTMLH2 is the interface that describes a <h2> HTML element.
HTMLH3 is the interface that describes a <h3> HTML element.
HTMLH4 is the interface that describes a <h4> HTML element.
HTMLH5 is the interface that describes a <h5> HTML element.
HTMLH6 is the interface that describes a <h6> HTML element.
HTMLHead is the interface that describes a <head> HTML element.
HTMLHeader is the interface that describes a <header> HTML element.
HTMLHr is the interface that describes a <hr> HTML element.
HTMLHtml is the interface that describes a <html> HTML element.
HTMLI is the interface that describes a <i> HTML element.
HTMLIFrame is the interface that describes a <iframe> HTML element.
HTMLImg is the interface that describes a <img> HTML element.
HTMLInput is the interface that describes a <input> HTML element.
HTMLIns is the interface that describes a <ins> HTML element.
HTMLKbd is the interface that describes a <kbd> HTML element.
HTMLLabel is the interface that describes a <label> HTML element.
HTMLLegend is the interface that describes a <legend> HTML element.
HTMLLi is the interface that describes a <li> HTML element.
HTMLLink is the interface that describes a <link> HTML element.
HTMLMain is the interface that describes a <main> HTML element.
HTMLMap is the interface that describes a <map> HTML element.
HTMLMark is the interface that describes a <mark> HTML element.
HTMLMeta is the interface that describes a <meta> HTML element.
HTMLMeter is the interface that describes a <meter> HTML element.
HTMLNav is the interface that describes a <nav> HTML element.
HTMLNoScript is the interface that describes a <noscript> HTML element.
HTMLObject is the interface that describes a <object> HTML element.
HTMLOl is the interface that describes a <ol> HTML element.
HTMLOptGroup is the interface that describes a <optgroup> HTML element.
HTMLOption is the interface that describes a <option> HTML element.
HTMLOutput is the interface that describes a <output> HTML element.
HTMLP is the interface that describes a <p> HTML element.
HTMLParam is the interface that describes a <param> HTML element.
HTMLPicture is the interface that describes a <picture> HTML element.
HTMLPre is the interface that describes a <pre> HTML element.
HTMLProgress is the interface that describes a <progress> HTML element.
HTMLQ is the interface that describes a <q> HTML element.
HTMLRp is the interface that describes a <rp> HTML element.
HTMLRt is the interface that describes a <rt> HTML element.
HTMLRuby is the interface that describes a <ruby> HTML element.
HTMLS is the interface that describes a <s> HTML element.
HTMLSamp is the interface that describes a <samp> HTML element.
HTMLScript is the interface that describes a <script> HTML element.
HTMLSection is the interface that describes a <section> HTML element.
HTMLSelect is the interface that describes a <select> HTML element.
HTMLSmall is the interface that describes a <small> HTML element.
HTMLSource is the interface that describes a <source> HTML element.
HTMLSpan is the interface that describes a <span> HTML element.
HTMLStrong is the interface that describes a <strong> HTML element.
HTMLStyle is the interface that describes a <style> HTML element.
HTMLSub is the interface that describes a <sub> HTML element.
HTMLSummary is the interface that describes a <summary> HTML element.
HTMLSup is the interface that describes a <sup> HTML element.
HTMLTable is the interface that describes a <table> HTML element.
HTMLTBody is the interface that describes a <tbody> HTML element.
HTMLTd is the interface that describes a <td> HTML element.
HTMLTemplate is the interface that describes a <template> HTML element.
HTMLTextarea is the interface that describes a <textarea> HTML element.
HTMLTFoot is the interface that describes a <tfoot> HTML element.
HTMLTh is the interface that describes a <th> HTML element.
HTMLTHead is the interface that describes a <thead> HTML element.
HTMLTime is the interface that describes a <time> HTML element.
HTMLTitle is the interface that describes a <title> HTML element.
HTMLTr is the interface that describes a <tr> HTML element.
HTMLU is the interface that describes a <u> HTML element.
HTMLUl is the interface that describes a <ul> HTML element.
HTMLVar is the interface that describes a <var> HTML element.
HTMLVideo is the interface that describes a <video> HTML element.
HTMLWbr is the interface that describes a <wbr> HTML element.
Initializer is the interface that describes a component that performs initialization instruction before being pre-rendered or mounted.
Mounter is the interface that describes a component that can perform additional actions when mounted.
Navigator is the interface that describes a component that can perform additional actions when navigated on.
Observer is an observer that observes changes for a given state.
Page is the interface that describes a web page.
PreRenderCache is the interface that describes a cache that stores pre-rendered resources.
PreRenderer is the interface that describes a component that performs instruction when it is server-side pre-rendered.
RangeLoop represents a control structure that iterates within a slice, an array or a map.
Resizer is the interface that describes a component that is notified when the app has been resized or a parent component calls the ResizeContent() method.
ResourceProvider is the interface that describes a resource provider that tells the Handler how to locate and get the package and static resources.
ServerDispatcher is the interface that describes a dispatcher that emulates a server environment.
Tagger is the interface that describes a collection of tags that gives context to something.
UI is the interface that describes a user interface element such as components and HTML elements.
Updater is the interface that describes a component that can do additional instructions when one of its exported fields is modified by its nearest parent component.
Value is the interface that represents a JavaScript value.
Wrapper is implemented by types that are backed by a JavaScript value.
# Type aliases
ActionHandler represents a handler that is executed when an action is created with Context.NewAction().
DispatchMode represents how a dispatch is processed.
Environment describes the environment variables to pass to the progressive web app.
EventHandler represents a function that can handle HTML events.
Kind represents the specific kind of a user interface element.
MsgHandler represents a handler to listen to messages sent with Context.Post.
StateOption represents an option applied when a state is set.
Tags represent key-value pairs that give context to what they are used with.
Type represents the JavaScript type of a Value.