1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-03-26 09:39:53 +00:00
Files
TiddlyWiki5/editions/dev/tiddlers/javascript-widget-tutorial/hello.js
2025-03-16 16:56:59 +01:00

31 lines
579 B
JavaScript

/*\
Hello, World widget
\*/
"use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
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 textNode = this.document.createTextNode("Hello, World!");
parent.insertBefore(textNode,nextSibling);
this.domNodes.push(textNode);
};
exports.hello = MyWidget;