Add setCounter feature.

This commit is contained in:
mmcw-dev 2017-10-23 20:41:28 -04:00
parent 8eccf05a68
commit 05da1f280f
1 changed files with 20 additions and 6 deletions

View File

@ -217,7 +217,7 @@
<div id="app"> <div id="app">
<div> <div>
<div class="label">Counter</div> <div class="label">Counter</div>
<input type="number" id="counter" value="0" step="1" /> <input type="number" id="counter" oninput="setCounter();" value="0" step="1" />
</div> </div>
<div> <div>
<div class="label">Direction</div> <div class="label">Direction</div>
@ -512,7 +512,6 @@ null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"
dataType : 'json', dataType : 'json',
success : web.setExposureSuccess success : web.setExposureSuccess
}); });
STATE.exposure = scaledExposure;
}; };
web.setExposureSuccess = function (res) { web.setExposureSuccess = function (res) {
'use strict'; 'use strict';
@ -531,16 +530,30 @@ null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"
$.ajax({ $.ajax({
method : 'POST', method : 'POST',
url : '/delay', url : '/delay',
data : JSON.stringify({ exposure : exposure }), data : JSON.stringify({ delay : scaledDelay }),
contentType: 'application/json', contentType: 'application/json',
dataType : 'json', dataType : 'json',
success : web.setDelaySuccess success : web.setDelaySuccess
}) });
STATE.delay = scaledDelay;
}; };
web.setDelaySuccess = function (res) { web.setDelaySuccess = function (res) {
STATE.delay = res.delay; STATE.delay = res.delay;
console.log('setDelay to ' + res.delay) console.log('setDelay to ' + res.delay);
};
web.setCounter = function () {
var counter = $('#counter').val();
$.ajax({
method : 'POST',
url : '/counter',
data : JSON.stringify({ counter : counter }),
contentType: 'application/json',
dataType : 'json',
success : web.setCounterSuccess
});
};
web.setCounterSuccess = function (res) {
STATE.counter = res.counter;
console.log('setCounter to ' + res.counter);
}; };
web.init = function () { web.init = function () {
'use strict'; 'use strict';
@ -548,6 +561,7 @@ null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"
getState = web.getState; getState = web.getState;
setDir = web.setDir; setDir = web.setDir;
setExposure = web.setExposure; setExposure = web.setExposure;
setCounter = web.setCounter;
web.getState(); web.getState();
}; };