Hi.

Straight to the point: I'd like to make a case for a __disconnect__ 
interface, like __connect__.

My use case is: I have a small library that wraps Google, Yahoo, etc 
maps.  I'm very happy that I don't need to listen for events I don't 
need; I can call GEvent.bind() or its analogue on the __connect__ 
method.  But I never "unlisten", since there is no __disconnect__.  
(Actually, I did an ugly hack on the event handler to check if the event 
is disconnected, but that's not quite ideal.)

Patch follows:
===================================================================
--- MochiKit/Signal.js  (revision 1292)
+++ MochiKit/Signal.js  (working copy)
@@ -695,11 +695,14 @@
             return;
         }
         ident.connected = false;
+        var src = ident.source;
         // check isDOM
         if (!ident.isDOM) {
+            if(typeof(src.__disconnect__) == 'function') {
+                src.__disconnect__(ident);
+            }
             return;
         }
-        var src = ident.source;
         var sig = ident.signal;
         var listener = ident.listener;
===================================================================


best,
                                               Lalo Martins
-- 
      So many of our dreams at first seem impossible,
       then they seem improbable, and then, when we
       summon the will, they soon become inevitable.
                           -----
personal:                    http://lalo.hystericalraisins.net/
technical:                    http://www.hystericalraisins.net/
GNU: never give up freedom                 http://www.gnu.org/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to