colpick-jQuery-Color-Picker icon indicating copy to clipboard operation
colpick-jQuery-Color-Picker copied to clipboard

Should use jQuery eventing

Open thany opened this issue 12 years ago • 6 comments

Instead of passing callbacks via the options object, you should be using jQuery's event model. That's exactly what it's for. So your users can much more easily attach events using the on() function, making it work exactly the same as any other event. Calling such events is dead simple too, using the trigger() function.

thany avatar Oct 02 '13 08:10 thany

Can't we have both callbacks (synchronous) and events (asynchronous)?

shprink avatar Dec 27 '13 12:12 shprink

Sounds messy. I do think the callbacks need to be deprecated then, at least. Spew out a console warning maybe.

I could be wrong btw, but I'm not sure that events are neccesarily asynchronous (nor are callbacks neccesarily synchrnous). They might just look that way. In either case, jQuery's eventing system has loads of advantages apart from uniformity (while uniformity may well be the greatest advantage - but ymmv).

thany avatar Dec 30 '13 20:12 thany

Thanks for the suggestion. It's much easier that way. I'll work on this as soon as I have a chance.

josedvq avatar Jan 22 '14 17:01 josedvq

As this plugin mimics Stefan Petre's color picker (http://www.eyecon.ro/colorpicker/), it would break code compatibly to remove or deprecate the callbacks. Maybe something for a more independent version 3?

mrgrain avatar Jan 17 '15 23:01 mrgrain

I'm not sure that compatibility with another plugin is valuable enough to keep archaic callbacks around. No offense, but I don't see the point. Besides, moving between any seemingly similar plugins is never trivial - as I've seen a fair share of datepickers, most of them work similarly, none of them are implemented similarly.

thany avatar Jan 19 '15 00:01 thany

Oh, I did this transition and TBH, I choose this plugin because of it's similarity. Both plugins have the same API, except from a new "base name" here ('colpick' instead of 'ColorPicker'). Plus, this one here is a real fork of Stefan Petre's. You'll notice when you diff both plugins.

Don't get me wrong - I'm 100% with you to use the new and better eventing system. I'm only worried about the right versioning.

mrgrain avatar Jan 19 '15 01:01 mrgrain