explicit model & collection properties in view
This commit is contained in:
+30
-18
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user