Scenic.Scene.init
You're seeing just the callback
init
, go back to Scenic.Scene module for more information.
Specs
init(scene :: t(), args :: term(), options :: list()) :: {:ok, new_state} | {:ok, new_state, timeout :: non_neg_integer()} | {:ok, new_state, :hibernate} | {:ok, new_state, opts :: response_opts()} | :ignore | {:stop, reason :: any()} when new_state: any()
Invoked when the Scene
is started.
args
is the argument term you passed in via config or ViewPort.set_root.
options
is a list of information giving you context about the environment
the scene is running in. If an option is not in the list, then it should be
treated as nil.
:viewport
- This is the pid of the ViewPort that is managing this dynamic scene. It will be not set, or nil, if you are managing the Scene in a static supervisor yourself.:styles
- This is the map of styles that your scene can choose to inherit (or not) from its parent scene. This is typically used by a child control that wants to visually fit into its parent's look.:id
- This is the :id term that the parent set a component when it was invoked.
The callback supports all the return values of the
init
callback in Genserver
.
In addition to the normal return values defined by GenServer, a Scene
can
return two new ones that push a graph to the viewport
Returning {:ok, state, push: graph}
will push the indicated graph
to the ViewPort. This is preferable to the old push_graph() function.