Set counter UI element. Make re-usable for app.

This commit is contained in:
mmcwilliams 2017-11-22 11:38:05 -05:00
parent fe492eca6f
commit 3d9985a372
1 changed files with 4 additions and 0 deletions

View File

@ -381,6 +381,9 @@
elem.value = (parseInt(current) + val); elem.value = (parseInt(current) + val);
STATE.counter += val; STATE.counter += val;
}; };
var forceCounter = function (val) {
document.getElementById('counter').value = val;
}
var unsetPages = function () { var unsetPages = function () {
const pages = document.getElementsByClassName('page'); const pages = document.getElementsByClassName('page');
const icons = document.getElementsByClassName('icon'); const icons = document.getElementsByClassName('icon');
@ -573,6 +576,7 @@
}; };
web.setCounterSuccess = function (res) { web.setCounterSuccess = function (res) {
STATE.counter = res.counter; STATE.counter = res.counter;
forceCounter(res.counter);
console.log(`setCounter to ${res.counter}`); console.log(`setCounter to ${res.counter}`);
}; };
web.useJson = function (res) { web.useJson = function (res) {