How to subscribe to data (such as IO, data) in the virtual flexpendant?

The current method is to get the target value all the time, but this method causes the trainer to get stuck, so would it be better to subscribe to the target value? Although I have read the documentation, I am still a little confused about the correct way to use it. Can you sample the correct code?