This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/dev/

Do nothing widget tutorial

 2nd February 2019 at 2:55pm

In order to define a widget in a tiddler, the tiddler must satisfy these requirements:

  • type field is application/javascript
  • module-type field is widget
  • the text field contains the javascript code

The donothing.js tiddler fulfills the requirements and its code looks like this:

/*\

Do nothing widget

\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

var Widget = require("$:/core/modules/widgets/widget.js").widget;

exports.donothing = Widget;

})();
That code does 2 key things:

Here's what it looks like:

And it worked. No error message this time.

Exercise: Modify donothing.js and Do nothing widget demo so the widget is named noop instead of donothing