Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove listenToAndRun #149

Merged
merged 1 commit into from
Aug 15, 2016
Merged

Remove listenToAndRun #149

merged 1 commit into from
Aug 15, 2016

Conversation

dhritzkiv
Copy link
Member

Since ampersand-view inherits from ampersand-state, which inherits from ampersand-events, which defines the listenToAndRun method, this definition in ampersand-view is no longer needed.

Since ampersand-view inherits from ampersand-state, which inherits from ampersand-events, which defines the listenToAndRun method, this definition in ampersand-view is no longer needed.
@dhritzkiv
Copy link
Member Author

I believe the behaviour is the same, with the exception of the return value (returning this vs undefined in ampersand-events and ampersand-view, respectively) so it shouldn't be breaking.

However, there is an if statement in ampersand-events::listenToAndRun –and not in ampersand-view– which I can't seem to understand, and would like some help understanding:

listenToAndRun: function (obj, name, callback) {
   this.listenTo.apply(this, arguments);
   if (!callback && typeof name === 'object') callback = this; //<--this line
   callback.apply(this);
   return this;
}

@wraithgar
Copy link
Contributor

Went ahead and searched through the commit history to find where this was added. Looks like the function hasn't changed since it was put in AmpersandJS/ampersand-events@9bb79f5#diff-0b121f2854b7a4eb5166c685e0f68ed1R170

It appears to have been in the predecessor to ampersand-event too from the very beginning https://github.com/n1k0/backbone-events-standalone/blob/master/backbone-events-standalone.js#L243

This means it was likely in backbone at the time, however it isn't anymore and I do not have the git skills to spelunk for that tonight.

@wraithgar
Copy link
Contributor

I say once we get #154 ironed out we rebase this and if the tests still pass we ship.

@cdaringe cdaringe merged commit ddde17c into AmpersandJS:master Aug 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants