1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00

Refactored TiddlyWiki methods

This commit is contained in:
Jeremy Ruston 2011-12-01 15:07:10 +00:00
parent 12665ce3a0
commit 69422a7023

View File

@ -11,17 +11,26 @@ TiddlyWiki.prototype.clear = function() {
this.tiddlers = {}; this.tiddlers = {};
}; };
TiddlyWiki.prototype.fetchTiddler = function(title) { TiddlyWiki.prototype.getTiddler = function(title) {
var t = this.tiddlers[title]; var t = this.tiddlers[title];
return t instanceof Tiddler ? t : null; return t instanceof Tiddler ? t : null;
}; };
TiddlyWiki.prototype.getTiddlerText = function(title) {
var t = this.tiddlers[title];
return t instanceof Tiddler ? t.fields.text : null;
};
TiddlyWiki.prototype.deleteTiddler = function(title) { TiddlyWiki.prototype.deleteTiddler = function(title) {
delete this.tiddlers[title]; delete this.tiddlers[title];
}; };
TiddlyWiki.prototype.isTiddler = function(title) {
return this.tiddlers[title] instanceof Tiddler;
}
TiddlyWiki.prototype.addTiddler = function(tiddler) { TiddlyWiki.prototype.addTiddler = function(tiddler) {
this.tiddlers[tiddler.title] = tiddler; this.tiddlers[tiddler.fields.title] = tiddler;
}; };
TiddlyWiki.prototype.forEachTiddler = function(callback) { TiddlyWiki.prototype.forEachTiddler = function(callback) {