1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-06-08 01:24:07 +00:00
Mario Pietsch 8aa558eb2c
Remove module function wrapper and add matching configurations for dprint and eslint (#7596)
* remove blks first try

* dprint.json seems to be OK, some forgotten functions

* add some more space-after-keyword settings

* server remove blks

* add **/files to dprint exclude

* dprint.js fixes a typo

* add boot.js and bootprefix.js to dprint exclude

* dprint change dprint.json

* add dprint fmt as script

* remove jslint comments

* fix whitespace

* fix whitespace

* remove function-wrapper from geospatial plugin

* fix whitespace

* add function wrapper to dyannotate-startup

* remove dpring.json
2025-03-21 17:22:57 +00:00

44 lines
979 B
JavaScript

/*\
Library function for creating widget using a dom creating function
\*/
"use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
function createDomWidget(domCreatorFunction) {
var MyWidget = function(parseTreeNode, options) {
this.initialise(parseTreeNode, options);
};
/*
Inherit from the base widget class
*/
MyWidget.prototype = new Widget();
/*
Render this widget into the DOM
*/
MyWidget.prototype.render = function(parent, nextSibling) {
this.parentDomNode = parent;
var domNode = domCreatorFunction(this.document);
parent.insertBefore(domNode, nextSibling);
this.domNodes.push(domNode);
};
/*
A widget with optimized performance will selectively refresh, but here we refresh always
*/
MyWidget.prototype.refresh = function(changedTiddlers) {
// Regenerate and rerender the widget and replace the existing DOM node
this.refreshSelf();
return true;
};
return MyWidget;
}
module.exports = createDomWidget;