"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.watchGraphSetUnitPinConstant = void 0;
const _1 = require("../../Class/$");
const stringify_1 = require("../../spec/stringify");
function watchGraphSetUnitPinConstant(event, graph, callback) {
    const listener = (...[unitId, type, pinId, constant, data, path,]) => {
        if (data instanceof _1.$) {
            data = null;
        }
        if (data !== undefined) {
            data = (0, stringify_1.stringify)(data);
        }
        callback({
            type: 'graph',
            event,
            data: {
                unitId,
                type,
                pinId,
                constant,
                data,
                path,
            },
        });
    };
    graph.prependListener(event, listener);
    return () => {
        graph.removeListener(event, listener);
    };
}
exports.watchGraphSetUnitPinConstant = watchGraphSetUnitPinConstant;
//# sourceMappingURL=watchGraphSetUnitPinConstantEvent.js.map