explicit model & collection properties in view

This commit is contained in:
Yuri Kuznetsov
2024-09-10 13:10:22 +03:00
parent 269d3e1210
commit 23f750180f
+30 -18
View File
@@ -44,24 +44,6 @@ class View extends BullView {
* @param {HTMLElement} element A target element.
*/
/**
* A model.
*
* @name model
* @type {module:model|null}
* @memberOf View.prototype
* @public
*/
/**
* A collection.
*
* @name collection
* @type {module:collection|null}
* @memberOf View.prototype
* @public
*/
/**
* A helper.
*
@@ -71,6 +53,36 @@ class View extends BullView {
* @private
*/
/**
* A model.
*
* @type {import('model').default}
*/
model
/**
* A collection.
*
* @type {import('collection').default}
*/
collection
/**
* @param {Record<string, *>} options
*/
constructor(options = {}) {
super(options);
if (options.model) {
this.model = options.model;
}
if (options.collection) {
this.collection = options.collection;
}
}
// noinspection JSUnusedGlobalSymbols
/**
* When the view is ready. Can be useful to prevent race condition when re-initialization is needed