From cadc93c8bbf7c31e4aba87fc9df265030508c7e1 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Thu, 5 Nov 2015 18:30:59 +0100 Subject: [PATCH] fgfs.js: simpler implementation of property-set Thanks to Laurent for the patch --- Phi/lib/fgfs.js | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/Phi/lib/fgfs.js b/Phi/lib/fgfs.js index 75e085388..2ba825921 100644 --- a/Phi/lib/fgfs.js +++ b/Phi/lib/fgfs.js @@ -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; };