4 ms·
Interesting, it's been a while since I looked at Dojo. I was still (incorrectly!) equating it as an alternative to jQuery, not as a full application framework.
by xyzzyb 15y ago
Interesting, it's been a while since I looked at Dojo. I was still (incorrectly!) equating it as an alternative to jQuery, not as a full application framework.
Are there other larger toolkits like Dojo that you could point me to?
- kls 15y agoDojo is probably the closest thing to a full application framework, give that it utilizes Require.js for AMD, has a test harness a complete object model, and a widget system with a life-cycle. The one thing that it lacks is a router, it has a state management mechanism, but it is no where near as robust as Backbone so I tend to prefer to use Backbone as my macro application router and then Dojo for everything else and mix in jQuery plugins for off the shelf widgets that Dojo does not have. The real power in Dojo is in Dojo.connect, I know jQuery has a plugin to provide this functionality but connect is the heart to Dojo, once you start wiring events and observers up via connects the architecture becomes very easy and straight forward. The thing with JavaScript is you really have to embrace an event based architecture, I know when people first come over they want to write macro controllers that control a view, where JavaScript works much better if you write discreet widgets that emit and respond to events. So you can have events like userInfoUpdated(userInfo) and any widget that needs to respond to that particular data update just connects a listener to the userInfoUpdated function. In jQuery you can use $(object).trigger("userInfoUpdated", [data]) and listen via $.bind. It is similar to connect but it does not give you a function signature on the object and it piggybacks on the event system so you have to be conscientious of bubbling and suppression, as you can bog the browsers event system down in larger apps. Thus I prefer connect as it does not piggyback on the event system.