package bonsai
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=1d68aab713659951eba5b85f21d6f9382e0efa8579a02c3be65d9071c6e86303
doc/bonsai.web_ui_url_var/Bonsai_web_ui_url_var/index.html
Module Bonsai_web_ui_url_varSource
module Original_components := ComponentsTypes that implement S can be parsed from a url and unparsed into a url.
Types that are sexpable can be turned a URL by storing the value as a sexp in a query parameter.
Creating a url-var involves passing in a module that implements S, but also a fallback value which will be used if S.parse_exn throws.
set updates the contents of the url-var as well as the current browser location. When how is `Push (which is the default), it will add a new entry to the top of the browser's history stack, but `Replace will cause it to replace the top entry of the history stack with the new URL.
update is like set, but gives you access to the previous value of the url right before setting it.
By asking for the Url_var.t's effect, you get a function that can be easily threaded through your components and triggered inside an action-application or inside of an event listener.
This module allows you to define your Url_var out of an OCaml type similar to the Typed Forms API. The module provides nice features like static analysis of your parser, ambiguity checking and functions to make backwards compatibility easier. Please read ../README.mdx first to make reading this MLI easier.