-
Notifications
You must be signed in to change notification settings - Fork 111
Description
A bean.one(elm, type, handler) handler cannot itself invoke bean.one with the same element, type and function. Here's an example where I listen for one mousemove event, and in the handler decide to listen for another mousemove event, but the handler never comes along.
http://jsbin.com/hobaya/1/edit?html,js,output
Result: my handler is called only for the first mousemove event
Expected: my handler should be called every time there is a mousemove event, since I explicitly listened to it again.
I figured out a workaround, which is to listen to a copy of the function. That produces the same effect because the copy !== the original function.
http://jsbin.com/fosuvi/1/edit?html,js,output
Alternatively, using setImmediate or setTimeout to move the one() call outside the call stack that resulted in calling the handler also works.