Listen for Variable Change in Figma Plugin

I am trying to trigger a code change when a variable is changed in Figma. This involves ‘listening’ to the status of each variable in the javascript file of a Figma plugin, then executing a function based on the variable change.

Right now, I’ve only found the ‘DocumentChange’ event and the ‘variableConsumptionMap’ to use for state listening, but it is very messy. The variable consumption map creates an object inside an object every time the variable is updated so it is difficult to manage.

Has anyone found another way to do this?

Thanks!!