staticrender

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package staticrender contains the static renderer which converts virtual DOM output to HTML via io.Writer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RWMutexEventEnv

type RWMutexEventEnv struct {
	sync.RWMutex
}

RWMutexEventEnv implements EventEnv interface with a mutex but no render behavior. (Because static rendering is driven by the caller, there is no way for dynamic logic to re-render a static page, so UnlockRender is the same as UnlockOnly.)

func (*RWMutexEventEnv) UnlockOnly

func (ee *RWMutexEventEnv) UnlockOnly()

UnlockOnly will release the write lock

func (*RWMutexEventEnv) UnlockRender

func (ee *RWMutexEventEnv) UnlockRender()

UnlockRender is an alias for UnlockOnly.

type StaticRenderer

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

StaticRenderer provides rendering as static HTML to an io.Writer.

func New

func New(w io.Writer) *StaticRenderer

New returns a new instance. w may be nil as long as SetWriter is called with a valid value before rendering.

func (*StaticRenderer) EventEnv

func (r *StaticRenderer) EventEnv() *RWMutexEventEnv

EventEnv returns a simple EventEnv implementation suitable for use with the static renderer.

func (*StaticRenderer) Render

func (r *StaticRenderer) Render(buildResults *vugu.BuildResults) error

Render will perform a static render of the given BuildResults and write it to the writer assigned.

func (*StaticRenderer) SetWriter

func (r *StaticRenderer) SetWriter(w io.Writer)

SetWriter assigns the Writer to be used for subsequent calls to Render. A Writer must be assigned before rendering (either with this method or in New).

Jump to

Keyboard shortcuts

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