Issho.Place behaviour (Issho v0.1.0)

Copy Markdown View Source

Where someone is, in a component's own terms: a row and a column in a grid, a node and an offset in a text, a point on a canvas. Never screen pixels, because each person has their own order, filters and zoom.

A place comes from a browser and goes to everyone else in the room, so a binding checks it (validate/1) before Issho shares it. The browser's half of a binding turns places into rectangles on the screen.

Places nest across components: a place in a text inside a canvas node is %{"doc" => "board:42/n7/body", "at" => %{"node" => "t3", "offset" => 4}} inside the room board:42. Issho checks the "doc" belongs to the room, and the binding of that document checks "at".

Summary

Callbacks

:ok for a place this binding draws, else an error.

Functions

Checks a place of the room: a map with the "doc" of the room and, in "at", the binding's own place. validators maps a document's id to its place module; a document with none accepts any small JSON value.

Callbacks

validate(place)

@callback validate(place :: term()) :: :ok | {:error, term()}

:ok for a place this binding draws, else an error.

Functions

check(place, room, validator)

@spec check(term(), String.t(), (String.t() -> module() | nil)) ::
  :ok | {:error, term()}

Checks a place of the room: a map with the "doc" of the room and, in "at", the binding's own place. validators maps a document's id to its place module; a document with none accepts any small JSON value.