Hi Stefano,

I can provide you some information:

* a widget is based on $:/core/modules/widgets/widget.js ... all the 
methods defined there are also accessible in your widget (and work with 
values based on your widget, like the refreshSelf method, that works with 
your parentDomNode defined on top with this.parentDomNode = parent), or you 
provide your own which will be used instead of the one in widget.js
* for your configuration panel this will be useful so that the widget 
refreshes its configuration whenever one of its configuration tiddlers 
changes:

YourWidget.prototype.refresh = function(changedTiddlers) {
//here, decide what to do, how to refresh when a configuration tiddler 
changes
if(changedTiddlers["$:/plugins/myname/myplugin/config/myconfig"] || 
changedTiddlers["$:/plugins/myname/myplugin/config/myotherconfig"]) {
//maybe when these tiddler change the widget needs a full refresh - depends 
on how your widget works. note that the refreshSelf method depends on 
this.parentDomNode being accessible, that's why it's saved at the top of 
the render method
this.refreshSelf();
return true;
} else if(changedTiddlers["
$:/plugins/myname/myplugin/config/myotherotherconfig"]) {
//maybe this config needs just to update a configuration value ...
this.configvalue = this.widget.wiki.getTiddlerText("
$:/plugins/myname/myplugin/config/myotherotherconfig");
//maybe I need to do some other processing / updating / refreshing based on 
an external library, maybe there's a way to update ... otherwise the 
refreshSelf method updates everything,
//given that somewhere, like in the execute method (which is usually called 
in the render method and used to get attributes and make child widgets), 
you get those values from the configuration tiddlers
}
}
//if none of our configuration tiddlers is contained within the array of 
all changed tiddlers (or if it's the otherotherconfig), just refresh the 
children based on this widget and the changed tiddlers
//see widget.js how the refreshChildren method looks like
return this.refreshChildren(changedTiddlers);
};



So, the refresh method basically makes changes in your configuration in 
user-land update the configuration in your widget

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/d27fd685-4e6f-48ee-9d8d-b542c276066f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to