Refactoring the method EventEmitter#on