salix/client/core/src/lib/component.js

28 lines
570 B
JavaScript
Raw Normal View History

/**
* Base class for component controllers.
*/
export default class Component {
/**
* The component owner window.
*/
get window() {
return this.document.defaultView;
}
/**
* The component owner document.
*/
get document() {
return this.element.ownerDocument;
}
/**
* Contructor.
*
* @param {HTMLElement} $element The main component element
*/
constructor($element) {
this.element = $element[0];
this.element.$ctrl = this;
}
}
Component.$inject = ['$element'];