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
Version 1.4.1 broke update callback #44
Comments
I believe now that |
Hm, this is a problem because jQuery solves this by having |
Try something like |
If I rebind the method, I lose the picker object (because it was passed as argument before but now it is as Edit: I have to do something like this: class Abc
constructor: ->
self = this
handlePickerChange = (color) ->
# `self` is the component instance.
# `this` is the picker instance.
self._handlePickerChange(color, this)
for input in @inputs
$input = $(input)
picker = new CP(input)
$input.data('picker', picker)
picker.on('change', handlePickerChange)
_handlePickerChange: (color, picker) => # <-- works
color = "##{color}"
$input = $(picker.source)
# ... do other stuff |
class Abc
constructor: ->
self = this
handlePickerChange = (color) ->
self._handlePickerChange.apply(this, [color]) |
I already am doing a call in the anonymous function so doing apply is not going to change anything. What I'd like to do is get rid of the anonymous function completely but that would require that the library passes the picker as an argument as it was before. |
Oh I forgot this: _handlePickerChange: (color) =>
color = "##{color}"
$input = $(this.source) |
Hello,
I tried updating your library from 1.4.0 to 1.4.1 and noticed the picker is no longer passed into events which causes issues if multiple pickers are used in the same page. We use it like this (sorry for CoffeeScript):
Is this fixable or should we do things differently?
Thank you,
Ollie
The text was updated successfully, but these errors were encountered: