All files / src/components/entities/base entityParent.js

100% Statements 24/24
100% Branches 0/0
100% Functions 7/7
100% Lines 24/24

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 30 31 32 33 34 35 36 37 38 39 40 41 42  1x 1x 1x 1x     150x 150x 150x 150x     2x     44x     1x     47x 47x 47x     1x 1x 1x 1x     1x 1x     1x 1x 1x 1x  
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EntityParent = void 0;
const parent_1 = require("../../../models/parent");
const eventCursor_1 = require("../events/eventCursor");
class EntityParent extends parent_1.Parent {
    constructor() {
        super();
        this.invalidate = this.invalidate.bind(this);
        this.refresh = this.refresh.bind(this);
        this.cursorChanged = this.cursorChanged.bind(this);
    }
    invalidate() {
        this.dispatchEvent(new Event(EntityParent.invalidateEvent));
    }
    refresh() {
        this.dispatchEvent(new Event(EntityParent.refreshEvent));
    }
    changeCursor(style) {
        this.dispatchEvent(new eventCursor_1.EventCursor(style, EntityParent.changeCursorEvent));
    }
    initializeChild(child) {
        child.addEventListener(EntityParent.invalidateEvent, this.invalidate);
        child.addEventListener(EntityParent.refreshEvent, this.refresh);
        child.addEventListener(EntityParent.changeCursorEvent, this.cursorChanged);
    }
    destroyChild(child) {
        child.removeEventListener(EntityParent.invalidateEvent, this.invalidate);
        child.removeEventListener(EntityParent.refreshEvent, this.refresh);
        child.removeEventListener(EntityParent.changeCursorEvent, this.cursorChanged);
        child.destroy();
    }
    cursorChanged(event) {
        const eventCursor = event;
        this.changeCursor(eventCursor.style);
    }
}
exports.EntityParent = EntityParent;
EntityParent.invalidateEvent = "invalidate";
EntityParent.refreshEvent = "refresh";
EntityParent.changeCursorEvent = "changecursor";