Add role() method to state object
Change-Id: Ie98f15c83d94c6cb1915942bba6c2ba17ae321e0
diff --git a/dev/js/src/buttongroup.js b/dev/js/src/buttongroup.js
index 65ea860..29453c3 100644
--- a/dev/js/src/buttongroup.js
+++ b/dev/js/src/buttongroup.js
@@ -106,12 +106,6 @@
* Add button that can toggle a state.
* The state has to be a state object.
*/
- /*
- * TODO:
- * Do not add a state object here, but embed the
- * state in the data and "roll()" through the different
- * state options instead.
- */
addToggle : function (title, data, state) {
let b = this._element.addE('span');
b.setAttribute('title',title);
@@ -147,11 +141,7 @@
e.halt();
// Toggle state
- if (state.get()) {
- state.set(false)
- } else {
- state.set(true);
- }
+ state.roll();
});
return b;