Module Eliom.Client_history

Pages of the application, the navigation history, and the data associated to each state of the History API. Internal module.

History states

type state = {
  1. template : string option;
  2. position : Mod_dom.position;
}

Data stored in the session storage for each state of the History API.

type state_id = {
  1. session_id : int;
  2. state_index : int;
    (*

    point in history

    *)
}
type saved_state = state_id * string

The value of history.state: the state id and the URL.

val saved_state_of_json : Deriving_Json_lexer.lexbuf -> saved_state
val saved_state_to_json : Buffer.t -> saved_state -> unit
val saved_state_json : saved_state Deriving_Json.t
val session_id : int

A random number identifying the current session of the browser tab.

history_state id uri is the history.state value of the page with state id at uri.

val get_state : state_id -> state

Reads the data of a state from the session storage. Raises Not_found if there is none.

val update_state : unit -> unit

Saves the template and the scroll position of the active page in the session storage.

Pages

val section_page : Logs.src
module Page_status : sig ... end

See Client.Page_status.

type page = {
  1. page_unique_id : int;
  2. mutable page_id : state_id;
  3. mutable url : string;
  4. page_status : Page_status.t React.S.t;
  5. mutable previous_page : int option;
  6. set_page_status : ?step:React.step -> Page_status.t -> unit;
  7. mutable dom : Js_of_ocaml.Dom_html.bodyElement Js_of_ocaml.Js.t option;
    (*

    The DOM of the page, when it is cached

    *)
  8. mutable reload_function : (unit -> unit -> Service.result Lwt.t) option;
}
val active_page : page ref

The page being displayed.

val set_active_page : page -> unit

Makes a page the active one, and retires the previous one.

val get_this_page : unit -> page

The page the running code is generating, or the active page outside of a page generation.

val with_new_page : ?state_id:state_id -> ?old_page:page -> replace:bool -> unit -> (unit -> 'a) -> 'a

with_new_page ~replace () f runs f in the context of a new page, which get_this_page returns. With ~replace:true, the new page takes the state id of the active page.

val advance_page : unit -> unit

Makes the page being generated the active one, and adds it to the history if it is not already there.

History

module History : sig ... end