2017-02-06 17:01:04 +00:00
|
|
|
/**
|
|
|
|
* Base class for component controllers.
|
|
|
|
*/
|
|
|
|
export default class Component {
|
|
|
|
/**
|
2017-04-28 13:04:29 +00:00
|
|
|
* The component owner window.
|
2017-02-06 17:01:04 +00:00
|
|
|
*/
|
|
|
|
get window() {
|
|
|
|
return this.document.defaultView;
|
|
|
|
}
|
2017-04-28 13:04:29 +00:00
|
|
|
/**
|
|
|
|
* The component owner document.
|
|
|
|
*/
|
|
|
|
get document() {
|
|
|
|
return this.element.ownerDocument;
|
|
|
|
}
|
2017-02-06 17:01:04 +00:00
|
|
|
/**
|
|
|
|
* Contructor.
|
2017-04-28 13:04:29 +00:00
|
|
|
*
|
2017-02-06 17:01:04 +00:00
|
|
|
* @param {HTMLElement} $element The main component element
|
|
|
|
*/
|
|
|
|
constructor($element) {
|
|
|
|
this.element = $element[0];
|
|
|
|
this.element.$ctrl = this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Component.$inject = ['$element'];
|