"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../../Class/Holder");
const _ids_1 = require("../../../../_ids");
class Register extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['unit', 'ref', 'name'],
            fo: [],
        }, {
            input: {
                ref: {
                    ref: true,
                },
                unit: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_REGISTER);
    }
    f({ ref, unit, name }, done) {
        // TODO
        this._name = name;
        this.__system.global.scope[name] = ref;
        this.__system.emitter.emit('register', name, ref);
    }
    d() {
        if (this._name) {
            this.__system.global.scope[this._name];
            this.__system.emitter.emit('unregister', this._name);
            this._name = undefined;
        }
    }
}
exports.default = Register;
//# sourceMappingURL=index.js.map