elixir_script v0.17.0 ElixirScript.View

Defines a module to handle view state. Handles the diffing and patching normally done manually using the VDom module.

def render(id) do
  Html.div [id: "hello"] do
    Html.span do
      "Hello"
    end
  end
end

#Starts View state and renders initial view
{:ok, view} = View.start(:document.body, &render/1, ["hello"])

#Updates the view with the new args
View.render(view, ["world"])

Summary

Functions

Updates the view by passing the args to the render_func

Starts the View state. This will render the initial view using the render_func and the args

Stops the View state

Functions

render(view, args)

Updates the view by passing the args to the render_func

start(dom_root, render_func, args)

Starts the View state. This will render the initial view using the render_func and the args

start(dom_root, render_func, args, options)
stop(view)

Stops the View state