Search code examples
widgetappcelerator

Are widgets the right place for simple controllers in Alloy?


I'm just wondering if putting simple functionality into widget form is a good way to go when using Appcelerator with Alloy. I have a JS file which acts as a simple wrapper for the Ti HTTPClient and I want to incorporate it into my Alloy project. If I create a widget with the HTTP functionality in the widget.js file, a blank widget.tss file and a stub widget.xml file, will I be incurring extra overhead because of the unused UI functionality in the widget? Should I just stick to putting my HTTP.js file in the app/lib directory and requiring it in my Alloy controller files?


Solution

  • Tony Lukasavage answered this question for me on the Google Group for Alloy:

    "If the code has no associated markup or tss styling, then yes, a commonjs module in app/lib would be the right choice"

    https://groups.google.com/forum/?fromgroups=#!topic/appc-ti-alloy/pSlB5elTans