Event for detecting the change of template/dashboard variable

Hello everyone,
I’m developing a custom plugin where I should detect the change of the value of a template/dashboard variable. Is there any way to do that?
Can anyone help me? Thanks in advance.