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

Instead of on-statechange, see if you can just databind the listener function into the element #27

Closed
lastmjs opened this issue Nov 3, 2016 · 1 comment

Comments

@lastmjs
Copy link
Owner

lastmjs commented Nov 3, 2016

The on-statechange event has some undesirable qualities. The biggest is that the parameter passed into the listener function is an event, and you have to go down a couple levels to actually get to the state. This makes it so that we have to create another TypeScript interface just to describe this kind of event. It would be a lot better if the first parameter to the listener function was just the state. To do this, we could just databind the listener function into the element. But, the last time I tried to databind class member methods into Polymer elements, everything exploded. I had a discussion with members of the Polymer team, and they don't seem to think this use case is valid without additional boillerplate code that doesn't make sense to me. Maybe I'll petition them again, or maybe Polymer 2 has fixed the issues.

@lastmjs
Copy link
Owner Author

lastmjs commented May 22, 2017

Actually, though Polymer 2 would allow us to data-bind a function, I don't think it would help that much. Events are easy to work with and make sense to most web developers...they are idiomatic. Binding a function is not as idiomatic I would say, and I don't see a compelling enough reason to do that here.

@lastmjs lastmjs closed this as completed May 22, 2017
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

No branches or pull requests

1 participant