Microsoft recently introduced us to a new set of event handlers, which can be used to register or deregister a function when an output parameter of a PCF control is changed. By using the OnOutputChange method, seamless communication between PCF control & Client API can be established. It is quite interesting to know that this works with standard as well as a virtual component. More on a virtual component can be checked here.
Let’s look at the event handlers that are introduced first. They are as follows –
var control = formContext.getControl("<name>"); control.addOnOutputChange(myFunction);
var control = formContext.getControl("<name>"); control.removeOnOutputChange(myFunction);