-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Use the public on
method when listening
#3615
Use the public on
method when listening
#3615
Conversation
@@ -149,10 +146,20 @@ | |||
} | |||
|
|||
// Bind callbacks on obj, and keep track of them on listening. | |||
internalOn(obj, name, callback, this, listening); | |||
var error = tryCatchOn(obj, name, callback, this); | |||
listening = void 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary - won't it be gced anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's now a private global.
Hold off on this for today, it has an issue because the other library won't update |
"The other library" ? Also, |
ecdaed6
to
b076de8
Compare
This uses a private `listening` var to share state between a Backbone "listener" and "listenee", instead of using a private `internalOn()` to share state. This allows `#listenTo` to use the public `#on` method and keeps interop between Backbone and any other event library.
b076de8
to
4bd7ec8
Compare
I've just revised the implementation to use a hybrid approach between #3455 and #3594. If the listenee is using Backbone's JsPerf tends to like the implementation, except Chrome doesn't like
Can you explain? |
A more descriptive name for what the property signifies.
Is there any chance this PR will be merged? |
@DomBlack +1 @jridgewell Do you need any help? |
@jridgewell I tried to rebase and fix merge errors in #4043 but a bunch of tests fails. Could you help me? |
Any updates on this? I've merged master into it in #4131, if that helps at all. |
Fixes #3611.
This uses a private
listening
var to share state between a Backbone"listener" and "listenee", instead of using a private
internalOn()
toshare state. This allows
#listenTo
to use the public#on
method andkeeps interop between Backbone and any other event library.
http://jsperf.com/internal-listening-public-on