This will be helpful when consumers don't want to
keep the target around.
A test is added to ensure this work as expected (and
was failing if the returned function does not call
EventEmitter.off).
Differential Revision: https://phabricator.services.mozilla.com/D56685