package bonsai
A library for building dynamic webapps, using Js_of_ocaml
Install
Dune Dependency
Authors
Maintainers
Sources
bonsai-v0.16.0.tar.gz
sha256=1d68aab713659951eba5b85f21d6f9382e0efa8579a02c3be65d9071c6e86303
doc/src/bonsai.example_chat_open_source_native/global_state.ml.html
Source file global_state.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
open! Core open! Async open Bonsai_chat_open_source_common type t = { message_bus : (Message.t -> unit) Bus.Read_write.t ; messages : Message.t Queue.t Room.Table.t } let create () = let message_bus = Bus.create_exn [%here] Arity1 ~on_subscription_after_first_write:Allow ~on_callback_raise:(fun error -> print_s [%sexp (error : Error.t)]) in let initial_messages = [ Message. { room = Room.of_string "incr_dom-room" ; author = "Bonsai Developers" ; contents = "hello world!" } ; Message. { room = Room.of_string "incr_dom-room" ; author = "Bonsai Developers" ; contents = "For deep and complex security purposes your messages will be hashed so that \ you can't use this platform for actual chatting" } ] in let messages = Room.Table.of_alist_exn [ Room.of_string "incr_dom-room", Queue.of_list initial_messages ; Room.of_string "bonsai-room", Queue.of_list initial_messages ] in { message_bus; messages } ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>