On the wiki at http://trac.mochikit.com/wiki/connectOnce there is this
implementation for a function that mimics 'connect' except it disconnects
after the signal fires once (copied from wiki):
function connectOnce(src, signal, dst, func) {
var S = MochiKit.Signal
var d
if (typeof(func) == 'undefined') {
func = dst
} else {
func = MochiKit.Base.method(dst, func)
}
var wrapper = function() {
func.apply(this, arguments)
S.disconnect(d)
}
d = S.connect(src, signal, wrapper)
}
Just trying to figure out if this is an equivalent implementation (it seems
to work, but just want to double-check):
function connectOnce(src, signal, dest, func) {
var connectionId = connect(src, signal, dest, func);
connect(src, signal, function() {
disconnect(connectionId);
});
}
Thanks
_________________________________________________________________
Share your latest news with your friends with the Windows Live Spaces
friends module.
http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mk
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---