The obj class represents a "obj" JSON CRDT node. As the generic type parameter, it takes a record of node builders. The optional generic type parameter is a record of optional keys.
obj
Example:
s.obj({ name: s.str(''), age: s.con(0),}); Copy
s.obj({ name: s.str(''), age: s.con(0),});
Specify optional keys as the second argument:
s.obj( { href: s.str('https://example.com'), }, { title: s.str(''), },) Copy
s.obj( { href: s.str('https://example.com'), }, { title: s.str(''), },)
Or, specify only the type, using the optional method:
optional
s.obj({ href: s.str('https://example.com'),}) .optional<nodes.obj({ title: nodes.str, })>() Copy
s.obj({ href: s.str('https://example.com'),}) .optional<nodes.obj({ title: nodes.str, })>()
Optional
Readonly
The
obj
class represents a "obj" JSON CRDT node. As the generic type parameter, it takes a record of node builders. The optional generic type parameter is a record of optional keys.Example:
Specify optional keys as the second argument:
Or, specify only the type, using the
optional
method: