all files / gluebert/src/controller/ controller.abstract.js

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29                                                 
/**
 * Class represents ControllerAbstract
 * @abstract
 */
class ControllerAbstract {
 
    /**
     * Create a new ControllerAbstract instance
     * @param {HTMLElement} element
     * @param {DataObserver} data
     * @param {ElementBuilder} elements
     */
    constructor(element, data, elements) {
        this._element = element;
        this._data = data;
        this._elements = elements;
    }
 
    /**
     * Callback when HTMLElement removed from DOM
     */
    destruct() {
        throw new Error('Controllers must provide a .destruct()-Method, fired, when HTMLElement is removed from DOM');
    }
}
 
export {
    ControllerAbstract,
};