Documentation
¶
Index ¶
Constants ¶
const ( PageDefaultAcceptHeader = "text/html" PageAcceptHeader = "application/void+page" PageDiffAcceptHeader = "application/void+page_diff" PageJSONAcceptHeader = "application/void+page_json" PageJSONDiffAcceptHeader = "application/void+page_json_diff" )
Variables ¶
This section is empty.
Functions ¶
func ServePage ¶
func ServePage(p Page, decoder DataDecoder) nhttp.ContextHandler
ServePage handles serving a page as html or depending on accept header renders either
func ServePageOptions ¶
func ServePageOptions() nhttp.ContextHandler
Types ¶
type Changes ¶
type Changes struct {
// contains filtered or unexported fields
}
Changes manages a giving page and allows you to render a page latest content from new data and a diff which is generated by comparing the latest render with the previous cached render.
func NewChanges ¶
type Component ¶
type Component interface {
Mount(SectionDocument, Data)
}
Component represents an encapsulated part of a page which is reusable for creating UI elements.
type ComponentFunc ¶
type ComponentFunc func(SectionDocument, Data)
ComponentFunc provides an implementation of a Component on a function type, allowing functional components.
func (ComponentFunc) Mount ¶
func (fn ComponentFunc) Mount(pg SectionDocument, d Data)
Mount implements Component interface.
type DataDecoder ¶
type Document ¶
Document represent a render target which produces a markup.Node which can be used to generate html/xml markup as response.
type Page ¶
type Page struct {
// contains filtered or unexported fields
}
Page implements the Document interface and represents a single unique html page.
func (*Page) AddComponent ¶
type SectionDocument ¶
type SectionDocument interface {
AddComponent(component Component)
}
SectionDocument represents a source which houses components which would be rendered as they are added into the page.
All components are positional, meaning where you add them will be where they occur within the page.
if you want more control then use a single component to embody more flexibility in components position.
type VoidRequest ¶
type VoidRequest struct { Data []byte `json:"data"` Session VoidSession `json:"_session"` }
type VoidSession ¶
type VoidSession struct { }