Merge pull request #211 from relm-us/doc-get-docs

Small improvements to Y.Doc().get(..) documentation
This commit is contained in:
Kevin Jahns 2020-06-16 22:28:24 +02:00 committed by GitHub
commit e07b0f4100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
* and do not overwrite each other. I.e.
* `y.define(name, Y.Array) === y.define(name, Y.Array)`
* and do not overwrite each other, i.e.
* `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)`.
*
* *Best Practices:*
* 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
* const y = new Y(..)