gwi/gwi
Values
pub fn process(
model model: dynamic.Dynamic,
msg msg: dynamic.Dynamic,
input_handler input_handler: fn(option.Option(model), msg) -> Result(
#(model, view),
error,
),
model_decoder model_decoder: fn() -> decode.Decoder(model),
msg_decoder msg_decoder: fn() -> decode.Decoder(msg),
model_to_json model_to_json: fn(model) -> json.Json,
view_to_json view_to_json: fn(view) -> json.Json,
) -> json.Json
Take a model and a msg, put them through the input handler funtion, then return the result as a JSON object. Where:
If successed:
{
model: output_model,
view: output_view,
}
If failed:
{
error: error,
}
For the model: nil, null, and undefined on Erlang, and undefined
and null on JavaScript count as None.
pub fn process_string(
model model: String,
msg msg: String,
input_handler input_handler: fn(option.Option(model), msg) -> Result(
#(model, view),
error,
),
model_decoder model_decoder: fn() -> decode.Decoder(model),
msg_decoder msg_decoder: fn() -> decode.Decoder(msg),
model_to_json model_to_json: fn(model) -> json.Json,
view_to_json view_to_json: fn(view) -> json.Json,
) -> String
Take a JSON string model and a JSON string msg, put them through the input handler funtion, then return the result as a JSON string. Where:
If successed:
{
model: output_model,
view: output_view,
}
If failed:
{
error: error,
}
For the model: empty string count as None.