Add role() method to state object
Change-Id: Ie98f15c83d94c6cb1915942bba6c2ba17ae321e0
diff --git a/dev/js/src/plugin/server.js b/dev/js/src/plugin/server.js
index e47cfbf..96b5cb7 100644
--- a/dev/js/src/plugin/server.js
+++ b/dev/js/src/plugin/server.js
@@ -158,14 +158,7 @@
// The associated service is existent
if (services[this.button['widgetID']]) {
-
- // TODO:
- // Use roll() when existing
- if (s.get()) {
- s.set(false);
- } else {
- s.set(true);
- };
+ s.roll();
return;
}
@@ -211,7 +204,7 @@
if (onClick["action"] && onClick["action"] == "setWidget") {
// Create a boolean state value, that initializes to true == opened
- obj['state'] = stateClass.create(true);
+ obj['state'] = stateClass.create([true, false]);
};
// Add to dynamic button list (e.g. for matches)
@@ -233,8 +226,12 @@
// TODO There is no possibility to add icons to an plugin toggle button right now.
else if (onClick["action"] == "toggle") {
- // Todo: Initially false
- let state = stateClass.create(false);
+ // TODO:
+ // Accept a "value" list here for toggling, which should
+ // also allow for "rolling" through states via CSS classes
+ // as 'toggle-true', 'toggle-false' etc.
+
+ let state = stateClass.create([true, false]);
// TODO:
// Lazy registration (see above!)