No activity today, make something!
tiddlyweb store hooks

20160313160653 cdent  

The TiddlyWeb store system provides a concept of HOOKS. These allow configurable actions that are performed after an entity (recipe, bag or tiddler) is get, put or deleted from the store. This is primarily useful with put to do logging, update an auxiliary information store, or do some kind of secondary action like execute a web hook, send an email notification.

Using them in your own instance requires the addition or creation of a plugin which manipulates the tiddlyweb.store.HOOKS dictionary. Learning how to use hooks is probably best done by inspecting existing examples. Please note that this is one of the more advanced aspects of extending TiddlyWeb and while simples behaviors are quite trivial, doing anything interesting requires a good understanding of the entire environment.

The core tests
These show an example of how a recipe HOOK is constructed by simply appended some text to a global after a store action.
tiddlywebplugins.whoosher
Sets up a _tiddler_change_handler which will update a Whoosh index whenever a tiddler is put or delete.
tiddlywebplugins.links
Establishes a hook to update a data with outgoing links from the current tiddler.
tiddlywebplugins.dispatcher
Lays in the infrastructure for asynchronous handling of HOOKS. Every time a tiddler is put or delete a message identifying that tiddler is sent down a beanstalkd queue.

Dispatcher is worth looking at alongside the Listener in whoosher and the PuSH ping handler in tiddlyspace.