0
Answered

Can I AddListener on System or Project Tokens change or update?

Tanapol E. 3 years ago in Applications / i3 Pro updated by Dmitry - support (expert) 3 years ago 2

Can I AddListener on System or Project Tokens change or update?


I try to do something like this

if(IR.GetVariable("System.Battery.Level") < 25)

{

IR.GetPage("pg_main").GetItem("label_battery").GetState(0).FillColor = 0xFF0000FF

}


 Now i use this one:

is there anyway to AddListener directly to token?


IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(name, value) 

 //Do stuff<

});

IR.SubscribeTagChange("System.Battery.Level");

Answered

Hello!


Unfortunately, there are no special listeners for tokens, so it's better to use a global listener like you did