define([ "dojo/_base/config", "dojo/_base/declare", "dojo/_base/lang", "dojo/dom-attr", "dojo/dom-class", "dojo/dom-construct", "dojo/dom-style", "dojo/on", "dojo/Evented", "dijit/_Widget" ], function(config, declare, lang, domAttr, domClass, domConstruct, domStyle, on, Evented, Widget){ /* widget definition */ });
define([ "dojo/_base/config", "dojo/_base/declare", "dojo/_base/kernel", "dojo/_base/lang", "dojo/dom-attr", "dojo/dom-class", "dojo/dom-construct", "dojo/dom-style", "dojo/on", "dojo/Evented", "dijit/_Widget" ], function(config, declare, kernel, lang, domAttr, domClass, domConstruct, domStyle, on, Evented, Widget){ return declare("evf/ComplexWidget", [Widget, Evented], { kernel: kernel, dojoConfig: config, lang: lang, domAttr: domAttr, domClass: domClass, domConstruct: domConstruct, domStyle: domStyle, dojoOn: on, listen: function(target, type, listener, dontFix) { var hndl = on(target, type, this.hitch(listener), dontFix); this.own(hndl); return hndl; }, hitch: function(fn) { return lang.hitch(this, fn); } }); });
define([ "dojo/_base/declare", "evf/CustomWidget" ], function(declare, ComplexWidget){ return declare("myApp/MyWidget", [ComplexWidget], { postCreate: function(){ this.inherited(arguments); this.domClass.add(this.domNode, 'MyWidgetCssClass'); } }); });
The result is easy access to commonly used modules without having to write a lot of boilerplate code.
No comments:
Post a Comment