model.on() returns the generated callback function (in case it generates a wrapper for paths), and adds a cleanup() method to it that removes the listener
However, if you add the same function as a handler for two different events, the cleanup() method will only ever remove the second event. (since both events will add the method to the same function instance)
For pathed listeners passed to on(), this is not a problem (since it generates a new wrapper every time)
model.on()
returns the generated callback function (in case it generates a wrapper for paths), and adds acleanup()
method to it that removes the listenerHowever, if you add the same function as a handler for two different events, the
cleanup()
method will only ever remove the second event. (since both events will add the method to the same function instance)For pathed listeners passed to
on()
, this is not a problem (since it generates a new wrapper every time)