All of the samples for Enyo (www.enyojs.com) uses a single file for their entire example. I like to encapsulate each entity into one file.
This is an example of an enyo.List stored as one JS file. The trick here is to use the ‘handlers’ to intercept the onSetupItem event.
enyo.kind( { name: "VerbList", kind: enyo.List, classes: "enyo-unselectable", touch:true, events: { onVerbSelected: "" }, handlers:{ onSetupItem: "setupItem" }, components: [{ kind: "VerbData", onLoadComplete: "loadVerbComplete" },{ kind: "VerbItem", classes: "list-verb-item enyo-border-box" }], rendered: function( ){ this.inherited(arguments); this.$.verbData.loadData( ); }, setupItem: function(inSender, inEvent){ var item = this.$.verbData.data[inEvent.index]; this.$.verbItem.setData(item); this.$.verbItem.setSelected(this.isSelected(inEvent.index)); return true; }, loadVerbComplete: function() { this.setCount(this.$.verbData.data.length); this.reset(); },