JSFiddle - React, Tailwind, and code Playground
by Deepak Anand
HTML
<div id ="containerTime1"></div>
<br>
<div id ="containerTime2"></div>
<br>
JavaScript
// Widget properties(if they are reference types) are shared across instances
// if they are not initialized in constructor/setter
require([
"dojo/_base/declare",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin"], function(declare, _WidgetBase, _TemplatedMixin){
var TimeWidget = declare([_WidgetBase, _TemplatedMixin], {
templateString: "<div>The time is <div data-dojo-attach-point = 'timeNode'></div></div>",
time: {},
_setTimeAttr: function(time){
this.timeNode.textContent = time;
this._set("time", time);
}
});
var time1 = new TimeWidget({}, "containerTime1");
time1.startup();
var time2 = new TimeWidget({}, "containerTime2");
time2.startup();
console.log(time1.get("time") === time2.get("time"));
});