jashkenas / backbone

Give your JS App some Backbone with Models, Views, Collections, and Events
http://backbonejs.org
MIT License
28.09k stars 5.38k forks source link

Lodash 5 Support #4145

Closed rafde closed 6 years ago

rafde commented 7 years ago

Since Backbone 1.3.3 supports Lodash 4, I figure I ask if Lodash 5 will be supported. https://github.com/lodash/lodash/wiki/Roadmap points out functions that are getting removed in favor of native approaches. This is pre-emptive since the roadmap gradually updates but the changes aren't difficult to make in the code base.

jashkenas commented 7 years ago

Want to submit a pull request, and we can see what the required changes would look like?

rafde commented 7 years ago

Will do.

rafde commented 7 years ago

changing _.bind to fn.bind would support IE9+. Is that a deal breaker? Browser support isn't mentioned in Backbone page.

paulfalgout commented 7 years ago

I believe IE8 has been unofficially dropped: https://github.com/jashkenas/backbone/pull/4008 https://github.com/jashkenas/backbone/issues/3828

jashkenas commented 7 years ago

Yes, that sounds fine, and not a deal breaker.

I would say, if we can keep support for all browsers that have > 0.5% global market share currently, I'm cool with it.

typhonrt commented 7 years ago

I'm all for this change as essentially this is a primary goal of backbone-esnext which is to remove dependence on Underscore if / as possible which I previously commented on in the preparing Backbone 1.4 issue.

A good article to peruse regarding native options vs Underscore / Lodash. I assume the mainline BB effort will target native functions with ES 5.1 and below. For my effort with backbone-esnext I'll be targeting ES2016 / stage 2 for switching to native functions.

A suggestion is to ship BB 1.4 as there are already enough changes in it to warrant a release. Then target 1.5 to include any potential switch to native functions and perhaps only these changes. I'd be glad to help with any PR in regard to a switch to native options.

As a proof of concept I already have removed Underscore from Events functionality in backbone-esnext-events. Mainly it was switching to fn.bind at #113, #217 though there might have been a few more changes I can't recall offhand.

I'm waiting for at least 1.4 to drop before I update backbone-es6 which tracks mainline BB or continue to work on backbone-esnext which will diverge a bit.

rafde commented 7 years ago

the only updates I found that need changes were _.bind. PR is up. Had to make a different PR for the CI to start working again.

typhonrt commented 7 years ago

@rafde indeed and a good catch.. Pretty straightforward and as you mentioned no other changes in Lodash 5 roadmap apply to BB.

To maintainers: ship it (1.4)! ;)

noobiek commented 7 years ago

Hi, Any news on this? Would love to have BB on Lodash. If any help required, please, announce. Thanks.