2018-01-20 00:46:47 -08:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import { get, getProperties } from '@ember/object';
|
2017-03-24 21:41:45 -07:00
|
|
|
|
|
|
|
export default Component.extend({
|
|
|
|
tagName: '',
|
|
|
|
|
|
|
|
didReceiveAttrs() {
|
|
|
|
this._super(...arguments);
|
|
|
|
|
|
|
|
['name', 'groupValue', 'value'].forEach(attr => {
|
2018-01-20 00:46:47 -08:00
|
|
|
if (!(attr in this)) {
|
|
|
|
throw new Error(`Attribute '${attr}' is required to be passed in when instantiating this component.`);
|
2017-03-24 21:41:45 -07:00
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
changed() {
|
|
|
|
const closureAction = get(this, 'attrs.changed');
|
|
|
|
|
|
|
|
if (typeof closureAction === 'function') {
|
|
|
|
return closureAction(...arguments);
|
|
|
|
}
|
2018-01-20 00:46:47 -08:00
|
|
|
get(this, 'changed')(...arguments);
|
2017-03-24 21:41:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|