"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.watchGraphInjectEvent = void 0;
const stringifySpec_1 = require("../../spec/stringifySpec");
function watchGraphInjectEvent(event, graph, callback) {
    const listener = (...[bundle, path]) => {
        const { spec } = bundle;
        (0, stringifySpec_1._stringifyGraphSpecData)(spec);
        callback({
            type: 'graph',
            event,
            data: {
                bundle,
                path,
            },
        });
    };
    graph.prependListener(event, listener);
    return () => {
        graph.removeListener(event, listener);
    };
}
exports.watchGraphInjectEvent = watchGraphInjectEvent;
//# sourceMappingURL=watchGraphInjectEvent.js.map