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