verma/pani — pull request #20 by crisptrutski (2014-11-09 10:31:33+00:00)
Title: Support unbinding event listeners

Since callback function gets wrapped, we need another mechanism to allow client code to remove it.

Returning an 'unsubscribe' 0-arity function from the subscriber is a pattern that's popped up in other libraries, and works well here.

Unfortunately in the return-channel case there is still no means available to shut it down.

Perhaps in the go block checking we could check if the channel is closed, and unsubscribe inside the callback? Slightly clumsy and would require an atom to get a reference to the returned closing-function inside an argument to the call that generates it..