Using message or event catchers to add functionality

Folks,

I am working on a method to better handle the tracking of closed tiddlers both for an undo close and history like mechanism, just for recently closed.

I am raising this here in an endeavour to solicit support someone with a deeper understanding of the message/event catcher widgets, and possibly javascript.

Here is where I outline what I need to do;

I have also raised this subject before Help please explaining/using the message catcher Widget

The main guidance I need is being faced with multiple messages, capturing the titles of the closed tiddlers in a list field (Prepend last closed) and continue on to issue the original messages which are both singular and multiple tiddler functions.

I expect if you are knowledgeable about catchers your advice may be simple to give.

  • The thing is the Message and Event catcher widget documentation is more developer oriented and assumes knowledge not documented on TiddlyWiki.com

With your support I hope to make a useful tool and may be able to add to the documentation from a designer perspective, rather than a developer.

Thanks in advance

I just shared some code which is similar to what you are asking:

It captures the navigate event, records it, and “forwards” it so the navigator widget will still see it. Something similar should work for other events.

I suppose the reason I need a more generic solution is I belive the close tiddler actions is not captured by navigate.

You may be interested its easy to add wiki wide catchers to the page template which means your can add a layout with the capture active.

This belief is not correct :slight_smile:

I adapted my example from the other thread to record the history of tiddler close events. See it in action at this share site link.

That code only handles the close event but you could add the close-others and close-all. For those you’d need to loop through the StoryList to record the tiddlers which will be closed.

Thanks @btheado that is a working solution, and I may follow something similar but incorporated in a layout to capture close.

However my question was a bit more general than just the close or as you demonstrate navigation.

  • How do I deal with close, close-others and close-all are they separate catchers or can they be combined in the EventCatcher?
  • Then when doing so How do I pass each on?

And I would hope to understand this so I can be assertive when adding some guiding documentation.

They can be combined.

<$messagecatcher $tm-close-tiddler=<<record-and-forward-close-event>>>
<$slot $name=ts-raw/>
</$messagecatcher>

becomes

<$messagecatcher
  $tm-close-tiddler=<<record-and-forward-close-event>>
  $tm-close-all-tiddlers=<<record-and-forward-close-all-event>>
  $tm-close-other-tiddlers=<<record-and-forward-close-other-event>>
>
<$slot $name=ts-raw/>
</$messagecatcher>

The latter two event handlers would need to loop through $:/StoryList to record the tiddlers.

The 3 action handlers are likely to have some sections of common code. After you write them you can identify the commonalities and factor them out into separate procedures.

1 Like

Thanks, it’s using that format / parameters in the message catcher, I did not get thanks @btheado.

Closs all can record all tiddlers in the story list, and clear the story list, and close other the same except for the current tiddler.

  • With the message catcher in the page template it should catch all, need to check menuBar.
1 Like