"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractAddUnitEventData = extractAddUnitEventData;
exports.stringifyAddUnitEventData = stringifyAddUnitEventData;
exports.watchGraphAddUnitEvent = watchGraphAddUnitEvent;
function extractAddUnitEventData(...[unitId, bundle, unit, path]) {
    return {
        unitId,
        bundle,
        path,
    };
}
function stringifyAddUnitEventData(data) {
    return data;
}
function watchGraphAddUnitEvent(event, graph, callback) {
    const listener = (...args) => {
        const data = stringifyAddUnitEventData(extractAddUnitEventData(...args));
        callback({
            type: 'graph',
            event,
            data,
        });
    };
    graph.prependListener(event, listener);
    return () => {
        graph.removeListener(event, listener);
    };
}
//# sourceMappingURL=watchGraphAddUnitEvent.js.map