Adds an event filter function.
a filter function
user data to be passed to the filter function, or null