diff --git a/bower.json b/bower.json index 61d89de..3598b13 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "strolch-wc-ws-observer", "description": "Strolch Polymer WebSocket observer update handler extension", - "version": "0.1.5", + "version": "0.2.0", "authors": [ "Robert von Burg" ], @@ -20,7 +20,7 @@ "homepage": "https://github.com/4treesCH/strolch-wc-ws-observer", "ignore": [], "dependencies": { - "strolchjs": "4treesCH/strolchjs#^0.2.7", + "strolchjs": "4treesCH/strolchjs#^0.2.8", "polymer": "Polymer/polymer#^1.11.3" } } diff --git a/strolch-wc-ws-observer.html b/strolch-wc-ws-observer.html index e010ba5..e68edfb 100644 --- a/strolch-wc-ws-observer.html +++ b/strolch-wc-ws-observer.html @@ -34,7 +34,7 @@ } }, - register: function (objectType, type, source, flat, callback) { + register: function (objectType, type, source, params, callback) { var byObjectType = observers[objectType]; if (byObjectType == null) { observers[objectType] = {}; @@ -45,7 +45,7 @@ if (byType == null) { byObjectType[type] = {}; byType = byObjectType[type]; - this._register(objectType, type, flat); + this._register(objectType, type, params); } if (byType[source] != null) { @@ -53,7 +53,7 @@ } byType[source] = callback; - console.log("Registered callback for " + objectType + " " + type + " " + source + " as " + (flat ? "flat" : "full") + " format"); + console.log("Registered callback for " + objectType + " " + type + " " + source + " params: " + JSON.stringify(params)); }, unregister: function (objectType, type, source) { @@ -71,25 +71,26 @@ console.log("Unregistered callback for " + objectType + " " + type + " " + source); }, - _register: function (objectType, type, flat) { + _register: function (objectType, type, params) { console.log("Registering for updates for " + objectType + " " + type); this._sendWsMessage({ msgType: "ObserverRegister", objectType: objectType, type: type, - flat: flat + params: params }); }, notifyObservers: function (msg) { var byObjectType = observers[msg.objectType]; - if (byObjectType == null) { + if (byObjectType == null) return; - } var byType = byObjectType[msg.type]; if (byType == null) { - return + byType = byObjectType["*"]; + if (byType == null) + return; } Object.keys(byType).forEach(function (k) {