"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../Class/Holder");
const _ids_1 = require("../../../_ids");
class New extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['class'],
            fo: ['unit'],
        }, {
            output: {
                unit: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_NEW);
    }
    f({ class: Class }, done) {
        const unit = new Class(this.__system);
        unit.play();
        this._unit = unit;
        done({ unit });
    }
    d() {
        if (this._unit) {
            this._unit.destroy();
            this._unit = undefined;
        }
    }
}
exports.default = New;
//# sourceMappingURL=index.js.map