View Source Hologram.Page behaviour (hologram v0.3.0)

Summary

Callbacks

Initializes component and server structs (when run on the server).

Returns a template in the form of an anonymous function that given variable bindings returns a DOM.

Functions

Casts page params string values to types specified with param/2 macro.

Defines page's layout metadata functions.

Accumulates the given param definition in params module attribute.

Returns the AST of code that registers params module attribute.

Defines page's route metadata functions.

Callbacks

init(map, t, t)

Initializes component and server structs (when run on the server).

template()

@callback template() :: (map() -> list())

Returns a template in the form of an anonymous function that given variable bindings returns a DOM.

Functions

cast_params(page_module, params)

@spec cast_params(module(), %{required(atom()) => String.t()}) :: %{
  required(atom()) => any()
}

Casts page params string values to types specified with param/2 macro.

layout(module, props \\ [])

(macro)
@spec layout(
  module(),
  keyword()
) :: Macro.t()

Defines page's layout metadata functions.

param(name, type, opts \\ [])

(macro)
@spec param(atom(), atom(), Hologram.Commons.Types.opts()) :: Macro.t()

Accumulates the given param definition in params module attribute.

register_params_accumulator()

@spec register_params_accumulator() :: Hologram.Compiler.AST.t()

Returns the AST of code that registers params module attribute.

route(path)

(macro)
@spec route(String.t()) :: Macro.t()

Defines page's route metadata functions.