neyric/wireit

View on GitHub
build/wires-delegate/wires-delegate-min.js

Summary

Maintainability
A
0 mins
Test Coverage
YUI.add("wires-delegate",function(e,t){e.WiresDelegate=function(){this._wires=[],this.publish("addWire"),this.publish("removeWire"),this.on("*:addWire",this._onAddWire,this),this.on("*:removeWire",this._onRemoveWire,this)},e.WiresDelegate.ATTRS={},e.WiresDelegate.prototype={_wireFromEvent:function(e){var t=e;while(!!t._event)t=t.details[0];return t},_onAddWire:function(e){this.addWire(this._wireFromEvent(e))},_onRemoveWire:function(e){this.removeWire(this._wireFromEvent(e))},addWire:function(t){var n=e.Array.indexOf(this._wires,t);n===-1&&(this._wires.push(t),this.fire("addWire",t))},removeWire:function(t){var n=e.Array.indexOf(this._wires,t),r,i;n!==-1&&(r=this._wires,this._wires=[],i=this._wires,e.Array.each(r,function(e){e!==t&&i.push(e)}),this.fire("removeWire",t))},destroyWires:function(){this._wires&&e.Array.each(this._wires,function(e){e.destroy()})},getConnected:function(){var e=[],t,n;if(this._wires)for(t=0,n=this._wires.length;t<n;t++)e.push(this._wires[t].getOtherTerminal(this));return e},redrawAllWires:function(){this._wires&&e.Array.each(this._wires,function(e){e._draw()})},destructor:function(){this.destroyWires()}}},"@VERSION@",{requires:["wire-base"]});