@nwebui/react-niagara-px
Version:
React Niagara Px View
28 lines • 1.11 kB
JavaScript
import { useComponent } from "@nwebui/react-niagara-core";
import { findConverter } from "../converters";
const SetPointBinding = function ({ nativeBinding }) {
const [comp] = useComponent(nativeBinding.gets("ord"));
const widgetEvent = nativeBinding.gets("widgetEvent");
const widgetProperty = nativeBinding.gets("widgetProperty");
if (comp) {
const widget = nativeBinding.parent;
widget.set(widgetProperty, comp.get("out", "value"));
const converters = Array.from(nativeBinding.children((c) => c.is("baja:Converter")));
converters.forEach((c) => {
try {
const ctor = findConverter(c.type.toString());
if (!ctor) {
throw new Error("Converter Not Found " + c.type);
}
const conv = new ctor(c);
conv.convert(widget, comp);
}
catch (e) {
console.error(e);
}
});
}
return null;
};
export default SetPointBinding;
//# sourceMappingURL=SetPointBinding.js.map