Closed karl-sjogren closed 6 years ago
You're right. I do want to maintain backwards compatibility. I'm considering branching this project and making a more modern ES6-friendly version on Konami-JS at some point.
I'll merge the pull request.
Thanks!
Also, you could rewrite it using ES6 right now if you add a Babel workflow to transpile a version of it down to ES5 as well. That way people get to chose which version they want without the need to maintain two different branches of the project.
That's a great idea @karl-sjogren. I'll look to do that when I can. In the meantime I've made the fix you suggested here.
In the last update you are using the "const" keyword in a single place.
https://github.com/snaptortoise/konami-js/blob/060339e39599c0fb9f87dcaa1bc22102ec4ed3df/konami.js#L77
This breaks in older IE (< 11) and some mobile browser. It also breaks running your code through uglifyjs2 unless I run it through babel first. How about switching it back to a regular "var" instead to make life easier for everyone? :)
Edit
You are also using the shorthand form for declaring a method in one place it seems.
https://github.com/snaptortoise/konami-js/blob/060339e39599c0fb9f87dcaa1bc22102ec4ed3df/konami.js#L102
I'm not sure about browser support here but it breaks uglifyjs2 at least.