discourse/app/assets/javascripts/wizard/components/radio-button.js.es6
Robin Ward 8d34f4bbd9 Revert "Revert Ember.run refactors"
This reverts commit fcb1ca52f9.
2019-10-30 09:48:24 -04:00

22 lines
495 B
JavaScript

import { next } from "@ember/runloop";
import Component from "@ember/component";
import { observes, on } from "ember-addons/ember-computed-decorators";
export default Component.extend({
tagName: "label",
click(e) {
e.preventDefault();
this.onChange(this.radioValue);
},
@observes("value")
@on("init")
updateVal() {
const checked = this.value === this.radioValue;
next(
() => (this.element.querySelector("input[type=radio]").checked = checked)
);
}
});