gwi/gwi

Values

pub fn process(
  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,
  error: null,
}

If failed:

{
  model: input_model,
  view: null,
  error: error,
}

For the model, empty string count as None.

Search Document