1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-10-25 12:47:40 +00:00

Introduced new Dependency() class to encapsulate dependency handling logic

Note that the format is now slightly different; see js/Dependencies.js
for details
This commit is contained in:
Jeremy Ruston
2012-02-17 14:11:25 +00:00
parent 8d4d168432
commit 103a9a4d7f
11 changed files with 87 additions and 80 deletions

View File

@@ -87,24 +87,9 @@ MacroNode.prototype.renderInDom = function(domNode,insertBefore) {
MacroNode.prototype.refresh = function(changes) {
var t,
self = this,
hasDependencyChanged = function() {
if(self.dependencies.dependentAll) {
return true;
}
for(var rel in self.dependencies) {
if(rel !== "dependentAll") {
for(var t in self.dependencies[rel]) {
if(changes.hasOwnProperty(t)) {
return true;
}
}
}
}
return false;
};
self = this;
// Check if any of the dependencies of this macro node have changed
if(hasDependencyChanged()) {
if(this.dependencies.hasChanged(changes)) {
// Re-execute the macro if so
var tiddler = this.store.getTiddler(this.tiddlerTitle);
this.execute(tiddler);
@@ -118,24 +103,9 @@ MacroNode.prototype.refresh = function(changes) {
MacroNode.prototype.refreshInDom = function(changes) {
var t,
self = this,
hasDependencyChanged = function() {
if(self.dependencies.dependentAll) {
return true;
}
for(var rel in self.dependencies) {
if(rel !== "dependentAll") {
for(var t in self.dependencies[rel]) {
if(changes.hasOwnProperty(t)) {
return true;
}
}
}
}
return false;
};
self = this;
// Check if any of the dependencies of this macro node have changed
if(hasDependencyChanged()) {
if(this.dependencies.hasChanged(changes)) {
// Ask the macro to rerender itself if it can
var tiddler = this.store.getTiddler(this.tiddlerTitle);
if(this.macro.refresh) {