ember-colpick
ember-colpick copied to clipboard
Feature/value change action
This PR makes sure an onChange event (https://github.com/yapplabs/ember-colpick/pull/18) is sent & the value is set only of a user interaction caused the value to change (see: https://github.com/mrgrain/colpick bySetColor flag).
This also allows the component to be used in a data-down/actions-up way (without 2-way binding on value).
// components/col-pick-button.js
import Component from '@ember/component';
import ColPickMixin from 'ember-colpick/mixins/col-pick';
export default Component.extend(ColPickMixin, {
flat: false
});
{{!-- hello.hbs --}}
{{#col-pick-button value=(unbound record.color) onChange=(action 'colorUpdated' record)}}
Hello
{{/col-pick-button}}
Without this, the component is exposed to some unpredictable 2-way binding side-effects; combine this and WebSocket updates and you may get XMas tree lights on your production app 😅.
I'm running this branch in production BTW: