From 1905a3f34350798d0aafc6cc6597920a9a559f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez=20Rivero?= Date: Wed, 28 Jun 2017 18:51:25 +0200 Subject: [PATCH] Add dev docs for notification mechanism (#2922) Documentation about the notifier module. I didn't say any, so I have created it. Regards --- editions/dev/tiddlers/new/notifier_util.tid | 30 +++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 editions/dev/tiddlers/new/notifier_util.tid diff --git a/editions/dev/tiddlers/new/notifier_util.tid b/editions/dev/tiddlers/new/notifier_util.tid new file mode 100644 index 000000000..da57bf39a --- /dev/null +++ b/editions/dev/tiddlers/new/notifier_util.tid @@ -0,0 +1,30 @@ +tags: dev +title: Notifier utility +type: text/vnd.tiddlywiki + +!! Overview + +The notifier module is part of tiddlywiki's utils suite. It displays the text contained on one as notification. +Notifications are an easy and visual mechanism to notify the user about key information. +Notifications appear on the right top border of the screen, and are automatically dismissed. +One usage example is the `saved wiki` notification you see each time the save button is clicked. +The notification module makes easier to display such notifcations, making all the heavy lifting of the notifcation creation +,appending it to the `DOM`, animation and `DOM` removal + +!! Parameters + +The notifier module only has one method (`display(title,options)`) that accepts two parameters + +* title: The title of an existing tiddler. +** If the tiddler does not exist, then no notification will take place +** The content of this tiddler will be transcluded into the notification body +* Options: An object conaining a `variables` property that will be used on the tiddler transclusion + +!! Usage + +A notifier instance is availably directly on the global `$tw` object. You can access it directly on any part of your code that +may need to notify something to the user + +```js +$tw.notifier.display("$:/language/Notifications/Save/Starting"); +```