]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/yui3/build/plugin/plugin.js
Release 6.2.0beta4
[Github/sugarcrm.git] / include / javascript / yui3 / build / plugin / plugin.js
1 /*
2  Copyright (c) 2009, Yahoo! Inc. All rights reserved.
3  Code licensed under the BSD License:
4  http://developer.yahoo.net/yui/license.txt
5  version: 3.0.0
6  build: 1549
7  */
8 YUI.add('plugin',function(Y){function Plugin(config){Plugin.superclass.constructor.apply(this,arguments);}
9 Plugin.ATTRS={host:{writeOnce:true}};Plugin.NAME='plugin';Plugin.NS='plugin';Y.extend(Plugin,Y.Base,{_handles:null,initializer:function(config){this._handles=[];},destructor:function(){if(this._handles){for(var i=0,l=this._handles.length;i<l;i++){this._handles[i].detach();}}},doBefore:function(sFn,fn,context){var host=this.get("host"),handle;context=context||this;if(sFn in host){handle=Y.Do.before(fn,host,sFn,context);}else if(host.on){handle=host.on(sFn,fn,context);}
10 this._handles.push(handle);return handle;},doAfter:function(sFn,fn,context){var host=this.get("host"),handle;context=context||this;if(sFn in host){handle=Y.Do.after(fn,host,sFn,context);}else if(host.after){handle=host.after(sFn,fn,context);}
11 this._handles.push(handle);return handle;},toString:function(){return this.constructor.NAME+'['+this.constructor.NS+']';}});Y.namespace("Plugin").Base=Plugin;},'3.0.0',{requires:['base-base']});