cferdinandi / cferdinandi/events

Feature request: Return `callback` function on methods.

Open
#13 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
61
Forks
13
PR merge metrics
No merged PRs in 30d

Description

## Feature request: Return `callback` function on methods.

If we turn off a listener, it requires `type, selector, callback` right? In this case, we write same function again and again.

For example:

```js
events.on("click", "document", function(){
return "Hello!";
});

...

events.off("click", "document", function(){
return "Hello!";
});
```

If the `on()` method give us callback function, we use it again and again.

Example:

```js
callback = events.on("click", "document", function(){
return "Hello!";
});

...

events.off("click", "document", callback);
```

In this case, you just add `return callback;` end of methods.

Contributor guide

Open the contributing guide

Research direction

Start by locating the on() and off() method implementations in the events library and check how listener callbacks are stored and matched. Confirm the returned value can be passed to off() for the same event and selector, then run the existing test suite or add coverage if the project provides tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.