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
|
2018-02-12 12:16:49 +00:00
|
|
|
* @param {$rootScope.Scope} $scope The element scope
|
2017-02-06 17:01:04 +00:00
|
|
|
*/
|
2018-02-12 12:16:49 +00:00
|
|
|
constructor($element, $scope) {
|
|
|
|
this.$ = $scope;
|
|
|
|
this.$element = $element;
|
2017-02-06 17:01:04 +00:00
|
|
|
this.element = $element[0];
|
|
|
|
}
|
|
|
|
}
|
2018-02-12 12:16:49 +00:00
|
|
|
Component.$inject = ['$element', '$scope'];
|