Skip to content

cacilhas/signal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Signal

Signal protocol for OCaml.

Use

let id =
    (* Connecting a handle to a signal *)
    Signal.connect "update" Renderer.update

let () =
    (* Emit signal *)
    Signal.emit "update" [`Int 12]

Types

type handle

The handle id.

type signal = string

The signal.

type arg = [ `Float of float
           | `Int of int
           | `Pair of int * int
           | `String of string
           ]

Argument type to the arguments list.

type callback = arg list -> unit

The handle’s callback.

Functions

val debug : bool -> unit

Enable or disable debugging.

val emit : signal -> arg list -> unit

Emite a signal.

val get : handle -> signal * callback

Return a handle by its id.

val connect : signal -> callback -> handle

Connect a callback to a signal, returning the handle id.

val disconnect : signal -> handle -> unit

Disconnect a handle from a signal.

About

Signal handler for OCaml

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages