mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 12:07:19 +00:00
Update dev docs for saver modules (#2919)
* Update Saver.tid Stupid typo corrected * Update Saver.tid Fix callback documentation in case of successful save.
This commit is contained in:
parent
bf51acd8d6
commit
6085b1171a
@ -13,8 +13,8 @@ Modules with ``module-type: saver`` provide functionality to save the whole wiki
|
||||
<dt>download</dt> <dd>This message is used when the wiki or a single tiddler should explicitly be downloaded. The control panel for example uses this method to provide a button which saves the wiki as a static HTML file.</dd>
|
||||
</dl>
|
||||
|
||||
A saver module has to export two functions. ``canSave(wiki)`` returning true if this module is capable of working and ``create(wiki}`` returning an instance of a saver object.
|
||||
This saver object has to provide an ``info`` property containing a name, a priority, an array of methods it supports and a method ``save(text,method,callback)``. This method is called from TW with the actual text which should be saved, the method which is used and a callback function to report errors: ``callback("Error while saving")`` or to notify that saving went well: ``callback("Saving went well :)")``. If the saver method successfully saved the file it has to return true, or false otherwise.
|
||||
A saver module has to export two functions. ``canSave(wiki)`` returning true if this module is capable of working and ``create(wiki)`` returning an instance of a saver object.
|
||||
This saver object has to provide an ``info`` property containing a name, a priority, an array of methods it supports and a method ``save(text,method,callback)``. This method is called from TW with the actual text which should be saved, the method which is used and a callback function to report errors: ``callback("Error while saving")`` or to notify that saving went well: ``callback(null, "Saving went well :)")``. If the saver method successfully saved the file it has to return true, or false otherwise.
|
||||
Saves are triggered by messages from the UI. The syncer module uses the saver with the highest priority capable of the requested method to save the file.
|
||||
|
||||
The core plug-in contains a saver capable of saving the current state of the wiki to the local hard drive by using a special Firefox extension called Tiddlyfox. If this extension is not available, the savers ``canSave`` method would return false. A saver with a lower priority would then ask the user to save the current state as a new HTML file.
|
Loading…
Reference in New Issue
Block a user