cynthia_websites_mini_client/model_type
Types
pub type MenuItem {
MenuItem(name: String, to: String)
}
Constructors
-
MenuItem(name: String, to: String)Arguments
- name
-
The name of the link
- to
-
The path to the link
pub type Model {
Model(
path: String,
complete_data: option.Option(configtype.CompleteData),
computed_menus: dict.Dict(Int, List(MenuItem)),
status: Result(Nil, String),
other: dict.Dict(String, dynamic.Dynamic),
sessionstore: storage.Storage,
safetimepassed: Bool,
)
}
Constructors
-
Model( path: String, complete_data: option.Option(configtype.CompleteData), computed_menus: dict.Dict(Int, List(MenuItem)), status: Result(Nil, String), other: dict.Dict(String, dynamic.Dynamic), sessionstore: storage.Storage, safetimepassed: Bool, )Arguments
- path
-
Where are we
- complete_data
-
Complete data that makes up the site. This is all that the server serves up.
- computed_menus
-
Menu’s stored readily for themes to pick up. Structure: Dict(which_menu: Int, List(#(to, from)))
- status
-
Status Allows us to trigger the error page from the update function, without the need for more variants of Model.
Normally this is
Ok(Nil)On error this isError(error_message: String) - other
-
Other variables This stores for example the current search term
- sessionstore
-
Session storage
- safetimepassed
-
Safe time passed – equals 200ms after initial load This is to allow for any hash changes that might have happened during the initial load to be caught and acted upon.
This replaces the previous
ticksvariable which was a count of ticks (50ms each) since load. Ticks >= 4 was considered safe time passed. Ticks led to unnecessary re-renders, which affected mobile performance negatively.
Values
pub fn time_decoder() -> decode.Decoder(Time)
Decodes the configurable variable value type ‘Time’