Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Docs: Adjusted code snippet for the view#createCollection() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewand committed Apr 3, 2020
1 parent b20a754 commit e470ac5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ export default class View {
* constructor( locale ) {
* super( locale );
*
* this.items = this.createCollection();
* const child = new ChildView( locale );
* this.items = this.createCollection( [ child ] );
*
* this.setTemplate( {
* tag: 'p',
Expand All @@ -265,17 +266,11 @@ export default class View {
* }
*
* const view = new SampleView( locale );
* const child = new ChildView( locale );
*
* view.render();
*
* // It will append <p></p> to the <body>.
* // It will append <p><child#element></p> to the <body>.
* document.body.appendChild( view.element );
*
* // From now on the child is nested under its parent, which is also reflected in DOM.
* // <p><child#element></p>
* view.items.add( child );
*
* @param {Iterable.<module:ui/view~View>} [views] Initial views of the collection.
* @returns {module:ui/viewcollection~ViewCollection} A new collection of view instances.
*/
Expand Down

0 comments on commit e470ac5

Please sign in to comment.