new api integrated

This commit is contained in:
2017-10-29 12:04:30 +01:00
parent 1c9739c5cf
commit 4f4e072542
12 changed files with 174 additions and 36 deletions

View File

@@ -4,23 +4,30 @@ Sui.ready(() => {
};
[{
api: 'MOTOR',
method: 'GET',
method: 'POST',
selector: '.motor.slider',
event: 'change',
data: function(){
return [this.getAttribute('data-motor-nr'), this.value];
data: function() {
let payload = {};
payload['motor' + this.getAttribute('data-motor-nr')] = this.value;
return Sui.util.serialize(payload);
},
onResponse: debugResponse
}, {
api: 'LASER',
method: 'GET',
method: 'POST',
selector: '.laser.slider',
event: 'change',
onResponse: debugResponse
onResponse: debugResponse,
data: function() {
return Sui.util.serialize({
laser: this.value
});
}
}].forEach(Sui.link({
api: {
MOTOR: '/motor/', // {motorNr}/{value}
LASER: '/laser/' // {value}
MOTOR: '/spirograph', // {motorNr}/{value}
LASER: '/spirograph' // {value}
}
}));
});