1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-23 13:53:15 +00:00

add /dev docs

This commit is contained in:
James Welford Anderson 2014-11-23 05:06:18 +09:00
parent 90caf5bf42
commit 1126458f8c
3 changed files with 36 additions and 2 deletions

View File

@ -1,8 +1,8 @@
modified: 20140920124011558
modified: 20141122200310516
tags: TableOfContents
title: HelloThere
Welcome to the developer documentation for TiddlyWiki (http://tiddlywiki.com/). It is currently a work in progress as material from two different sources is adapted and merged:
Welcome to the developer documentation for TiddlyWiki (http://tiddlywiki.com/). It is currently a work in progress as material from two different sources is adapted and merged in addition to original content being added:
* An assignment by Christian Jurke and Christian Heigele, two students working on their Master's degree in Information Technology at the Gießen University of Applied Sciences (Technische Hochschule Mittelhessen). Their work can be seen in the [[Introduction]] and the tiddlers that link from it.
* The original developer documentation from http://tiddlywiki.com:
@ -22,3 +22,5 @@ Welcome to the developer documentation for TiddlyWiki (http://tiddlywiki.com/).
** SyncAdaptorModules
** WidgetModules
** WikiRuleModules
*Original developer documentation
** [[Hook Mechanism]]

View File

@ -0,0 +1,24 @@
created: 20141122200310516
modified: 20141122200310516
title: Hook Mechanism
type: text/vnd.tiddlywiki
The Hook Mechanism provides a way for plugins to hook into and modify default functionality. Hooks can be added to the wiki by calling the following from a plugin:
``$tw.hooks.addHook(name,function definition);``
Multiple hooks can be appended to the same name using repeated calls to the above. When a hook is invoked by name all registered functions will be called seqentially in their order of addition.
Though not essential care should be taken to ensure that hooks are added before they are invoked. For example: [[Hook: tc-opening-default-tiddlers-list]] should ideally be added before the story widget is invoked otherwise any hook specified additions to the default tiddlers will not be seen on the initial loading of the page, though will be visible if the user clicks the home button.
!!Example
A working example of addition to a hook that adds "test" to the default tiddlers.
```javascript
$tw.hooks.addHook("th-opening-default-tiddlers-list",function(list) {
list.push("test");
return list;
});
```

View File

@ -0,0 +1,8 @@
created: 20141122200310516
modified: 20141122200310516
title: Hook: tc-opening-default-tiddlers-list
type: text/vnd.tiddlywiki
This hook allows plugins to add aditional tiddlers to those specified in [[$:/DefaultTiddlers]].
The function definition takes a list of tiddlers as it's argument and should return a modified list of tiddlers to display when the wiki is first loaded or the home button is pressed. This hook is invoked after ``$tw.wiki.filterTiddlers`` is called on the contents of [[$:/DefaultTiddlers]] and it is therfore not correct to append additional filters to the list argument as they will not be subsequently applied.