All files / src/models parent.js

100% Statements 24/24
100% Branches 9/9
100% Functions 10/10
100% Lines 23/23

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     96x     173x 173x     59x 66x 66x       3x 2x 1x 1x 1x   1x     2x 2x 2x 1x 1x 1x       4x     1x  
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Parent = void 0;
const bounds2_1 = require("./bounds2");
class Parent extends bounds2_1.Bounds2 {
    get children() {
        return this._children;
    }
    constructor() {
        super();
        this._children = new Array();
    }
    add(...children) {
        children.forEach(child => {
            this._children.push(child);
            this.initializeChild(child);
        });
    }
    insert(index, ...children) {
        if (index < 0 || index >= this._children.length || this._children.length < 1)
            return false;
        children.forEach(child => {
            this._children.splice(index, 0, child);
            this.initializeChild(child);
        });
        return true;
    }
    remove(...children) {
        children.forEach(child => {
            const index = this._children.indexOf(child);
            if (index < 0 || index >= this._children.length)
                return;
            this._children.splice(index, 1);
            this.destroyChild(child);
        });
    }
    destroy() {
        this._children.forEach(child => this.destroyChild(child));
    }
}
exports.Parent = Parent;