How to use eventcatcher to listen for tm-close-tiddler?

I have recently been working on some custom view content. Whenever I open a tiddler, I can click different buttons to display various information about it, which relies on a state tiddler to manage the display.

I want to automatically clear this state tiddler when the tiddler is closed. I have already figured out the filter expression for the logic, but I am not sure how to use the eventcatcher widget to specifically listen for the tm-close-tiddler message and trigger the action.

[all[tiddlers]prefix[$:/state/node-buttosn/]removeprefix[$:/state/node-buttosn/]] -[[$:/StoryList]get[list]enlist-input[]]

tm-close-tiddler is not an event… it’s a message. Try using the MessageCatcherWidget.

You may need to modify the $:/core/ui/PageTemplate and put the $messagecatcher within the content of the $navigator widget (which normally handles the tm-close-tiddler message). Your $messagecatcher action will also need to resend the tm-close-tiddler message so that the normal $navigator widget handling will still be triggered.

-e