package fmlib_browser

  1. Overview
  2. Docs

Module Fmlib_browserSource

Web Applications Running in the Browser

Documentation

Introduction to Web Applications

API

Sourcemodule Random : sig ... end

Generate Random Numbers

Sourcemodule Time : sig ... end

Posix Time

Sourcemodule Value : sig ... end

Javascript Values

Sourcemodule Event_flag : sig ... end

Event flags to stop propagation and prevent default action.

Sourcemodule Decoder : sig ... end

Decoder for Javascript Values

Sourcemodule Task : sig ... end

Tasks to be performed within Commands

Sourcemodule Command : sig ... end

Commands to be executed as a result of an update operation.

Sourcemodule Subscription : sig ... end

Subscriptions to global events.

Sourcemodule Attribute : sig ... end

Attributes of Dom Elements.

Sourcemodule Html : sig ... end

Virtual Dom

Sourceval sandbox : 'state -> ('state -> 'msg Html.t) -> ('state -> 'msg -> 'state) -> unit
Sourceval element : string -> ('state * 'msg Command.t) Decoder.t -> ('state -> 'msg Html.t) -> ('state -> 'msg Subscription.t) -> ('state -> 'msg -> 'state * 'msg Command.t) -> unit

element my_app init view subs update

Create a browser application named my_app on the javascript side. The application creates the global object named my_app which contains the two functions init and post.

The application is started on the javascript side with

    my_app.init ({
        data: <initialisation object>,
        element_id: <id of the element under which the application works>,
        onMessage: <function to receive messages on the javascript side from
                    the application>
    })

The javascript code can post messages to the application by

    my_app.post (message)
Sourceval application : string -> ('state * 'msg Command.t) Decoder.t -> ('state -> 'msg Html.t * string) -> ('state -> 'msg Subscription.t) -> ('state -> 'msg -> 'state * 'msg Command.t) -> unit

application my_app init view subs update

Create a browser application named my_app on the javascript side. The application creates the global object named my_app which contains the two functions init and post.

The application is started on the javascript side with

    my_app.init ({
        data: <initialisation object>,
        onMessage: <function to receive messages on the javascript side from
                    the application>
    })

The javascript code can post messages to the application by

    my_app.post (message)
OCaml

Innovation. Community. Security.