The _WidgetBase
module may not provide all the widget functionality your application will need. The dijit
package provides mixins, or JavaScript object extensions, for your widget. These mixins can provide HTML templates, event handling for clicks, touches, focus, and a lack thereof, for example. Loading the right mixin with your application can save you a lot of behavior coding. Let's take a look at some of the ones we may use.
The _TemplatedMixin
module lets the module replace its existing HTML content with either a string template, or HTML from another source. The widget's template string is assigned through the templateString
property. This allows the widget to skip a possibly complicated buildRendering
step. You can see an example of a _TemplatedMixin
module call in the following code snippet:
require(["dojo/_base/declare", "dijit/_WidgetBase", "dijit/_TemplatedMixin"], function (declare, _WidgetBase, _TemplatedMixin) { declare("ShoutingWidget...