mirror of
https://github.com/0x1d/esp8266-laser.git
synced 2025-12-16 18:45:05 +01:00
new api integrated
This commit is contained in:
@@ -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}
|
||||
}
|
||||
}));
|
||||
});
|
||||
Reference in New Issue
Block a user