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

23 lines
491 B
JavaScript
Raw Normal View History

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