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) {
|
||||
if( value == null )
|
||||
return;
|
||||
//this.value = val; value should be updated via PropertyListener
|
||||
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;
|
||||
}
|
||||
this.listener.setProperty(this.path, value);
|
||||
}
|
||||
|
||||
FGFS.Property.prototype.hasValue = function() {
|
||||
|
@ -125,6 +106,7 @@ FGFS.PropertyListener = function(arg) {
|
|||
command : 'get',
|
||||
node : path
|
||||
}));
|
||||
prop.listener = this;
|
||||
}
|
||||
return this._nextId;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue