plugin.js revision 007d778311954420082ea0ea11f663d75d6a02c9
64953b0596d07dbee9a9b521ed61c434ce4709b5Satyen Desai * Provides the base Plugin class for building widget plugins.
2b449ca06646ebb6603e35918a40bca8e0f43c8eSatyen Desai * @module plugin
2b449ca06646ebb6603e35918a40bca8e0f43c8eSatyen Desai * Plugin provides a base class for all Plugin classes.
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * @class Plugin
fd76c7686fc15c4633e2199dbbfd992864f245d8Satyen Desai * @extends Base
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * @param {Object} config The configuration object for the
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai Plugin.superclass.constructor.apply(this, arguments);
fd76c7686fc15c4633e2199dbbfd992864f245d8Satyen Desai * Static property provides a string to identify the class.
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * @property Plugin.NAME
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * @type {String}
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * Static property provides the namespace the plugin will be
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * registered under.
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * @property Plugin.NS
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * @type {String}
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * Initializer lifecycle implementation.
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * @method initializer
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * @param {Object} config Configuration object literal for the plugin
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * desctructor lifecycle implementation.
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * Removes any listeners attached by the Plugin and restores
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * and over-ridden methods.
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * @method destructor
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai // remove all handles
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai for (var i = 0, l = this._handles.length; i < l; i++) {
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * Listens for events and methods fired by the owner widget.
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * The handler is called before the event handler or method is called.
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * @method doBefore
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * @param sFn The event of method to listen for.
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * @param fn The handler function to call when the listener fires.
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * @param context An optional context to call the handler with.
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * Default context is the plugin instance.
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai * @return Handle A handle that can be used to detach the handler (e.g. "handle.detach()").
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai handle = Y.Do.before(fn, this._owner, sFn, context);
c938b255ef3c02ee132e52fbd15bb211c6f3f760Satyen Desai * Listens for events and methods fired by the owner widget.
c938b255ef3c02ee132e52fbd15bb211c6f3f760Satyen Desai * The handler is called after the event handler or method is called.
c938b255ef3c02ee132e52fbd15bb211c6f3f760Satyen Desai * @method doAfter
c938b255ef3c02ee132e52fbd15bb211c6f3f760Satyen Desai * @param sFn The event of method to listen for.
c938b255ef3c02ee132e52fbd15bb211c6f3f760Satyen Desai * @param fn The handler function to call when the listener fires.
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * @param context An optional context to call the handler with.
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * Default context is the plugin instance.
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai * @return Handle A handle that can be used to detach the handler (e.g. "handle.detach()").
1201815cf554ddd27ca4898d9623926cfe3c2ac9Satyen Desai handle = Y.Do.after(fn, this._owner, sFn, context);
969d790cf689400dd37fcf1f11c1909a66c06de9Satyen Desai toString: function() {
fd76c7686fc15c4633e2199dbbfd992864f245d8Satyen Desai return this.constructor.NAME + '[' + this.constructor.NS + ']';