We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bucklescript-tea has Tea_cmd.call which allows you to enqueue callbacks for example in the update of the model.
This makes handling callbacks from websockets for example much easier. A Ws implementation could look something like this:
let update model = function | `Join -> let () = Vdom.Cmd.call (fun callbacks -> Ws.Channel.join model.channel (fun msg -> callbacks.enqueue (`Joined msg)) in return model | .... )
The text was updated successfully, but these errors were encountered:
I've found a way to simulate this:
type 'msg Vdom.Cmd.t += Run of (('msg -> unit) -> unit) let update model = function | `Async -> return model ~c: [ Run (fun send -> send `Msg)] let cmd_handler ctx = function | Run cb -> cb (fun x -> Vdom_blit.Cmd.send_msg ctx x) ; true | _ -> false let () = Vdom_blit.(register (cmd { f = cmd_handler }))
Still it would be nice to have this as a build-in option
Sorry, something went wrong.
No branches or pull requests
Bucklescript-tea has Tea_cmd.call which allows you to enqueue callbacks for example in the update of the model.
This makes handling callbacks from websockets for example much easier. A Ws implementation could look something like this:
The text was updated successfully, but these errors were encountered: