ygleam/y
Types
pub type AbstractType
pub type Transaction
The Value type represents the JavaScript types Yjs can hold:
- null
- String
- Boolean
- Number
- Uint8Array
- Array
- Object<String, Value>
- Any Yjs type
pub type Value
pub type XmlElement
pub type XmlFragment
Values
pub fn dict(
dict: dict.Dict(k, v),
keys: fn(k) -> String,
values: fn(v) -> Value,
) -> Value
Encode a Dict into a JSON object using the supplied functions to encode the keys and the values respectively.
pub fn js_array(
from entries: List(a),
of inner_type: fn(a) -> Value,
) -> Value
Encode a list into a JS array.
pub fn nullable(
from input: option.Option(a),
of inner_type: fn(a) -> Value,
) -> Value
Encodes an optional value into a y.Value, using null if None
pub fn object(entries: List(#(String, Value))) -> Value
Encode a list of key-value pairs into a JSON object.
pub fn xml_element(input: XmlElement) -> Value
Encodes a Yjs XmlElement to a y.Value
pub fn xml_fragment(input: XmlFragment) -> Value
Encodes a Yjs XmlFragment to a y.Value