View Source Yex.Doc (y_ex v0.6.2)

Summary

Functions

Stop monitoring document updates.

Get or insert the array type.

Get or insert the map type.

Get or insert the text type.

Get or insert the xml fragment type.

Monitor document updates.

Create a new document.

Create a new document with options.

Types

@type t() :: %Yex.Doc{reference: any()}

Functions

@spec demonitor_update(reference()) :: :ok | {:error, term()}

Stop monitoring document updates.

Link to this function

demonitor_update_v1(sub)

View Source
Link to this function

demonitor_update_v2(sub)

View Source
@spec get_array(t(), String.t()) :: Yex.Array.t()

Get or insert the array type.

@spec get_map(t(), String.t()) :: Yex.Map.t()

Get or insert the map type.

@spec get_text(t(), String.t()) :: Yex.Text.t()

Get or insert the text type.

Link to this function

get_xml_fragment(doc, name)

View Source

Get or insert the xml fragment type.

@spec monitor_update(t()) :: {:ok, reference()} | {:error, term()}

Monitor document updates.

@spec new() :: t()

Create a new document.

Link to this function

transaction(doc, origin \\ nil, exec)

View Source

Start a transaction.

Examples

iex> doc = Doc.new()
iex> text = Doc.get_text(doc, "text")
iex> Yex.Doc.monitor_update(doc)
iex> Doc.transaction(doc, fn ->
iex>   Text.insert(text, 0, "Hello")
iex>   Text.insert(text, 0, "Hello", %{"bold" => true})
iex> end)
iex> assert_receive {:update_v1, _, nil, _}
iex> refute_receive {:update_v1, _, nil, _} # only one update message
@spec with_options(Yex.Doc.Options.t()) :: t()

Create a new document with options.