algolia / instantsearch

⚡️ Libraries for building performant and instant search and recommend experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/
MIT License
3.61k stars 504 forks source link

widget.init implementation change #575

Closed vvo closed 8 years ago

vvo commented 8 years ago
widget.init(state, helper, this.templatesConfig);

should be

widget.init({state, helper, templatesConfig});

To be consistent with render(). I wonder how we missed that :D

This is needed for 1.0.0, mostly search and replace here. Not a lot of widgets are using init.

redox commented 8 years ago

widget.init({state, helper, templatesConfig});

About that, I think it's not so nice to have object-based parameters for those 3 "public" methods. As soon as you don't use ES6, it looks weird: https://github.com/instantsearch/instantsearch-ion.rangeSlider/blob/master/src/widget.js#L26-L28

So I would rather do the opposite :p

vvo commented 8 years ago

As soon as you don't use ES6

Agree. But if you do not use ES6 then you should not have strong opinions on whether the interface is good or not? (Not trying to isolate people but really imagine if they would be frustrated). I guess it's ok.

bobylito commented 8 years ago

I'm not a huge advocate of object options but truth is that is widely used. I don't think anyone would be that frustrated. So I also guess it's ok :)

vvo commented 8 years ago

was done