diff --git a/src/utils/Doc.js b/src/utils/Doc.js index 8a8936b9..62643617 100644 --- a/src/utils/Doc.js +++ b/src/utils/Doc.js @@ -187,22 +187,22 @@ export class Doc extends ObservableV2 { /** * Define a shared data type. * - * Multiple calls of `y.get(name, TypeConstructor)` yield the same result + * Multiple calls of `ydoc.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)` + * `ydoc.get(name, Y.Array) === ydoc.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 `ydoc.share.get(name)`. * * *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 Y.Doc instance is created and store them in a separate object. * Also use the typed methods `getText(name)`, `getArray(name)`, .. * * @template {typeof AbstractType} Type * @example - * const y = new Y(..) + * const ydoc = new Y.Doc(..) * const appState = { - * document: y.getText('document') - * comments: y.getArray('comments') + * document: ydoc.getText('document') + * comments: ydoc.getArray('comments') * } * * @param {string} name diff --git a/src/utils/Transaction.js b/src/utils/Transaction.js index c5931ab4..829589ec 100644 --- a/src/utils/Transaction.js +++ b/src/utils/Transaction.js @@ -28,7 +28,8 @@ import { callAll } from 'lib0/function' * possible. Here is an example to illustrate the advantages of bundling: * * @example - * const map = y.define('map', YMap) + * const ydoc = new Y.Doc() + * const map = ydoc.getMap('map') * // Log content when change is triggered * map.observe(() => { * console.log('change triggered') @@ -37,7 +38,7 @@ import { callAll } from 'lib0/function' * map.set('a', 0) // => "change triggered" * map.set('b', 0) // => "change triggered" * // When put in a transaction, it will trigger the log after the transaction: - * y.transact(() => { + * ydoc.transact(() => { * map.set('a', 1) * map.set('b', 1) * }) // => "change triggered"