mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-07-15 00:14:22 +00:00
1a95ec9ac4
Thanks to @cjrk and @cheigele for contributing their developer docs (which can be found at https://github.com/cjrk/saa-tw). By the way, I plan to remove the “creator” and “modifier” fields but will keep a prominent acknowledgement for your contributions.
25 lines
1.1 KiB
Plaintext
25 lines
1.1 KiB
Plaintext
chapter.of: Widgets
|
|
created: 20140715080302422
|
|
creator: Christian Heigele, Christian Jurke
|
|
modified: 20140717181635787
|
|
modifier: Christian Heigele, Christian Jurke
|
|
sub.num: 1
|
|
tags: doc
|
|
title: Messages
|
|
|
|
Messages are events that are triggered by the user. They are generated by widgets for example when the user clicks on a ~ButtonWidget.
|
|
Each message has a type property like "tw-delete-tiddler" and a parameter.
|
|
|
|
```
|
|
{type: "tw-delete-tiddler", param: "MyOldTiddler"}
|
|
```
|
|
|
|
When such a message is created by a widget it sends the message to it's parent widget which sends it to it's own parent widget and so on.
|
|
On this way each widget can try to dispatch the message.
|
|
This concept is realised in the base widget object.
|
|
It provides a function ``dispatchEvent(message)`` which is called by the children to bubble the message up the widget tree.
|
|
Another function ``addEventListener(type,listener)`` can be used to bind a function to a specific message type.
|
|
If the listener returns false, the message is send to the parent widget.
|
|
|
|
The TiddlyWiki core plug-in handles a lot of messages in the [[NavigatorWidget|RootWidget and Rendering Startup]].
|