Check out a free preview of the full jQuery Plugins and jQuery UI course:
The "Advantages of the Widget Factory" Lesson is part of the full, jQuery Plugins and jQuery UI course featured in this preview video. Here's what you'd learn in this lesson:

Advantages of using jQuery’s event binding methods: Keeps the widget instance context intact, doesn’t callback when it is disabled and automatically cleans up events. Use the “data” method to eliminate the need to call methods through the plugin wrapper while also being able to access private methods. Plugin wrapper vs. direct access of plugin instance: Using the wrapper is most familiar to users, although direct access is sometimes preferred. “Inheriting” from existing widgets is done the same way as extending existing widgets, applying a second argument to the $.widget method. Extending widgets with versions 1.8 and 1.9 is very easy - simply “stick” new methods on existing widgets. Marc briefly touches on writing his own abstraction similar to TWF, but ended up with throwing it away and actually using TWF instead!

Get Unlimited Access Now