23 lines
491 B
JavaScript
23 lines
491 B
JavaScript
|
/**
|
||
|
* 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'];
|