Hi,
this must be a bunch of stupid questions but I'm still learning the logic of javascript.
1) when is the global $tw variable available?
- what "module" are required for it to be available ?
- does it become available after `require("$:/core/modules/widgets/widget.js");` ? Why ?
- how come $tw can be used in the filter.js module ? as show below
exports.getFilterOperators = function() {
if(!this.filterOperators) {
$tw.Wiki.prototype.filterOperators = {};
$tw.modules.applyMethods("filteroperator",this.filterOperators);
}
return this.filterOperators;
};
Is it because getFilterOperators is defined inside "exports" ??
2) To use the filter API, and in particular the filterTiddler function defined in filters.js (see below), must I "require" filter.js, or widget.js, or wiki.js or ???
exports.filterTiddlers = function(filterString,widget,source) {
var fn = this.compileFilter(filterString);
return fn.call(this,source,widget);
};
3) the `this.wiki` of Widgets is initialized through the option parameters in the Widget constructor.
so all the function exported by wiki.js are available through this.wiki ?
4) Is there like a list of "public" function available through $tw, $tw.utils and this.wiki ? I am trying to guess by reading through the various *.js modules, but I'm my knowledge of JS make this task a bit tedious...
Thanks for any hint or explanations or info.
Alain