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

fix #768 issue (Manager.off method) #839

Closed
wants to merge 2 commits into from

Conversation

sculove
Copy link
Contributor

@sculove sculove commented Aug 10, 2015

I resend pr that seperate unrelated changes.

When you didn't attach an event and you use a Hammerjs.Manager.off method , you will see script error.
I think that hammerjs have to handle exception.

I modified Hammerjs.Manager.off method.
also I added test case in test_events.js

@sculove sculove mentioned this pull request Aug 10, 2015
delete handlers[event];
} else {
handlers[event].splice(inArray(handlers[event], handler), 1);
if (typeof handlers[event] !== 'undefined') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need to check typeof handlers[event] !== 'undefined' here isn't it enough to just check handlers[event] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your opinion is better. ok. I will change code.
how about following code?

if (!handler) {
    delete handlers[event];
} else {
    handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
}

@arschmitz
Copy link
Contributor

@sculove 2 small changes i would like to see but looks good thank you.

When you didn't attach an event and you use a Hammerjs.Manager.off
method , you will see script error.
@sculove
Copy link
Contributor Author

sculove commented Aug 10, 2015

@arschmitz Thank you :)

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.

2 participants