fgfs.js: simpler implementation of property-set
Thanks to Laurent for the patch
This commit is contained in:
parent
94a5384b40
commit
cadc93c8bb
1 changed files with 2 additions and 20 deletions
|
@ -18,26 +18,7 @@ FGFS.Property.prototype.getPath = function() {
|
||||||
FGFS.Property.prototype.setValue = function(value) {
|
FGFS.Property.prototype.setValue = function(value) {
|
||||||
if( value == null )
|
if( value == null )
|
||||||
return;
|
return;
|
||||||
//this.value = val; value should be updated via PropertyListener
|
this.listener.setProperty(this.path, value);
|
||||||
var url = "/json/" + this.path;
|
|
||||||
switch( typeof(value) ) {
|
|
||||||
case 'number':
|
|
||||||
case 'string':
|
|
||||||
case 'boolean':
|
|
||||||
$.post(url, JSON.stringify({'value' : value}))
|
|
||||||
.fail(function(err){
|
|
||||||
console.log("Error while setting property value: " + err);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
case 'object':
|
|
||||||
$.post(url, JSON.stringify(value))
|
|
||||||
.fail(function(err){
|
|
||||||
console.log("Error while setting property value: " + err);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FGFS.Property.prototype.hasValue = function() {
|
FGFS.Property.prototype.hasValue = function() {
|
||||||
|
@ -125,6 +106,7 @@ FGFS.PropertyListener = function(arg) {
|
||||||
command : 'get',
|
command : 'get',
|
||||||
node : path
|
node : path
|
||||||
}));
|
}));
|
||||||
|
prop.listener = this;
|
||||||
}
|
}
|
||||||
return this._nextId;
|
return this._nextId;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue