ets-berkeley-edu/calcentral — pull request #36 by yuhunglin (2012-09-13 02:49:42+00:00)
Title: [CLC-83] Refactored with attempt to share code between the widgets

This is the follow up to https://github.com/ets-berkeley-edu/calcentral/pull/31. The original pull request had quite a bit of messy code copy-pasting from two different widgets to merge the functionality into the my classes widget.

I noticed that the OAE style of maintaining reference to the Widgets themselves after they were loaded, was there in the current iteration of CalCentral. Thus it should technically be possible to recycle and reuse functions from other widgets, as long as they're exposed. However, there is the issue of dealing with the async loading of widgets. There's the very straightforward solution of waiting on $(window).load() but that would be ugly and slow. I've attempted to use a JS object collection of Deferreds, which can easily signal whenever a widget had finished loading, making it possible for people to implement flexible logic on which specific widget they were dependent on, instead of waiting for everything to load.

The pull is moreso to make it easy for @christianv to merge if the approach seems right, although anyone is welcome to review and comment.