The notification mechanism is provided by the TiddlyWiki store object
to enable interested parties to register callback functions to be
invoked when tiddlers are modified. Callbacks can be registered to be
called for modifications to particular named tiddlers, or to be called
for modifications to any tiddler.

To register new callback functions one should make use of the addNotification method

Out of the box, the notification table looks like this (see Refresh.js
in the TiddlyWiki source repository):
config.notifyTiddlers = [
{name: "StyleSheetLayout", notify: refreshStyles},
{name: "StyleSheetColors", notify: refreshStyles},
{name: "StyleSheet", notify: refreshStyles},
{name: "StyleSheetPrint", notify: refreshStyles},
{name: "PageTemplate", notify: refreshPageTemplate},
{name: "SiteTitle", notify: refreshPageTitle},
{name: "SiteSubtitle", notify: refreshPageTitle},
{name: "ColorPalette", notify: refreshColorPalette},
{name: null, notify: refreshDisplay}
];
Note that these notification handlers are called while TiddlyWiki is
starting up and the store is being loaded from the HTML payload in the
document. Quite a lot of care is taken in the core to make sure that
this doesn't trigger double initialisation (where the main() function
explicitly initialises something that is also re-initialised inside a
notification handler).

The notification table is a global variable. It would be more correct
for each instance of the TiddlyWiki store object to have it's own
notification handler table.

One of the problems with the naivety of the notification mechanism is
that it can be quite noisy; if a piece of code is modifying a bunch of
tiddlers the torrent of notifications triggered can slow things down.
To resolve this, the TiddlyWiki object provides methods to temporarily
suspendNotifications() and resumeNotifications(). The core uses this
to improve the performance of the importTiddlers macro by suppressing
notifications as individual tiddlers are imported and issuing a
blanket notification at the end of the import.
bag
tiddlywikidev_public
created
Wed, 09 Mar 2011 11:24:03 GMT
creator
jon
modified
Thu, 10 Mar 2011 16:07:50 GMT
modifier
jon
tags
notification
theme
TWDocTheme