Small improvements to Y.Doc().get(..) documentation

This commit is contained in:
Duane Johnson 2020-06-09 18:46:14 -06:00
parent 6dd26d3b48
commit 78c947273e

View File

@ -65,17 +65,17 @@ export class Doc extends Observable {
} }
/** /**
* Define a shared data type. * Get a shared data type by name. If it does not yet exist, define its type.
* *
* Multiple calls of `y.get(name, TypeConstructor)` yield the same result * Multiple calls of `y.get(name, TypeConstructor)` yield the same result
* and do not overwrite each other. I.e. * and do not overwrite each other, i.e.
* `y.define(name, Y.Array) === y.define(name, Y.Array)` * `y.get(name, Y.Array) === y.get(name, Y.Array)`
* *
* After this method is called, the type is also available on `y.share.get(name)`. * After this method is called, the type is also available on `y.share.get(name)`.
* *
* *Best Practices:* * *Best Practices:*
* Define all types right after the Yjs instance is created and store them in a separate object. * Define all types right after the Yjs instance is created and store them in a separate object.
* Also use the typed methods `getText(name)`, `getArray(name)`, .. * Also use the typed methods `getText(name)`, `getArray(name)`, `getMap(name)`, etc.
* *
* @example * @example
* const y = new Y(..) * const y = new Y(..)