DmitryBaranovskiy/eve — Issue #3: simpler 'unbind' with scope (string) instead of function
Author: gr2m
Created: 2011-11-14 17:14:40+00:00
State: open

Hey Dimitry,

I do highly respect your JavaScripts and maybe my suggestion is nonsense, I'd be happy for a hint what you would do.

Here's my scenario:

I have several models that subscribe to events from a socket. With eve, the binding would look like:

```javascript
eve.on('change/Model_xyz', function() { ... })
```

There are tons of bindings all around the place. My understanding is that I could not simply unbind the particular event above, I'd need to wrap the anonymous function into some method (e.g. `Model.make_stuff`) and then pass this method when I do an unbind, correct?

```javascript
eve.unbind('change/Model_xyz', Model.make_stuff)
```

I wonder if it would make sense to extend the implementation of eve, so that I could use a simple string to scope a bind/unbind. It my example, it would look like:

```javascript
eve.on('change/Model_xyz', function() { ... }, 'unique_id_here')
eve.unbind('change/Model_xyz', 'unique_id_here')
```

What do you think? Does that make any sense to you?