"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../../Class/Holder");
const _ids_1 = require("../../../../_ids");
class Listen extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['emitter', 'event'],
            fo: [],
            i: [],
            o: ['data'],
        }, {
            input: {
                emitter: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_LISTEN, 'remove');
        this._unlisten = undefined;
    }
    f({ emitter, event }) {
        const listener = (...data) => {
            if (this._paused) {
                return;
            }
            this._output.data.push(data[0]);
        };
        this._unlisten = emitter.addListener(event, listener);
    }
    d() {
        if (this._unlisten) {
            this._unlisten();
            this._unlisten = undefined;
        }
    }
}
exports.default = Listen;
//# sourceMappingURL=index.js.map