The Javascript code of my simple highlight widget (Simple HighlightWidget (again)) is structured in the way TiddlyWiki widget code is structured (e.g., button.js) and works well in a single HTML file TiddlyWiki. I am currently working on making the widget a plugin with node.js. When serving the plugin with the code as is I get a reference error:
Error executing boot module HighlightWidget.js: ReferenceError: window is not defined
(or with a slight modification in the code document is not defined; the code requires both the window and document objects).
Following https://groups.google.com/g/TiddlyWiki/c/pjqXOaHGw1w/m/7oXkXEdhAQAJ I restructured the code as follows:
exports.name = "highlight";
exports.after = ["story"];
exports.highlight = HighlightWidget;
exports.startup = function() {
// The code is now here
}
It is unclear what the value of exports.name should be: highlight, anttt/highlight, $:/plugins/anttt/highlight", or something else?
The references error(s) no longer occur with the modified structure, but … as the debugger tells me, the exports.startup function is never called and the widget is not created, not in the single HTML file with only the plugin and not when the plugin is served with node.js. I seem to be overlooking something or doing something wrong.
Also, what are the various options for exports.after and are they documented anywhere?
Thanks for helping me solve this problem.