Adds an event handler that runs when the value of a widget property is changed.
A widget receives an onPropsChanged
event when one or more of its properties is changed via its API.
function onPropsChanged(handler: function): any;
handler(oldProps: object, newProps: object): void
The name of the function or
the function expression to run when the value of a widget property is changed.
$widget.onPropsChanged((oldProps, newProps) => {
loadProductData(newProps.productId);
loadCustomerData(newProps.customerId);
});
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.