Switch: Try to set the propertyChange event to Switch via Typescript


#1

Hi there, I am trying to hook the propertyChange event to a Switch via Typescript but seems like I am missing something, this is my code:

let switch1 = new Switch();
switch1.on('propertyChange', (args) => {
    console.log('change...');
});
layout12.addChild(switch1);

Am I missing some code?

Thanks!


#2

Using propertyChange event was 2.x architecture, starting 3.x you have use the propertyName + “change” for listening to changes on UI components. If you want to monitor changes on checked property, the event you need is checkedChange.