diff --git a/api.js b/api.js index 4115f4c..eba6bab 100644 --- a/api.js +++ b/api.js @@ -319,6 +319,10 @@ SoundTouchAPI.prototype.socketUpdate = function(json) { if (this.socket.recentsUpdatedListener != undefined) { this.socket.recentsUpdatedListener(json.recentsUpdated); } + } else if (json.zoneUpdated != undefined) { + if (this.socket.zoneUpdatedListener != undefined) { + this.socket.zoneUpdatedListener(json.zoneUpdated); + } } else { console.log("Other update", json); } @@ -352,6 +356,10 @@ SoundTouchAPI.prototype.setRecentsUpdatedListener = function(handler) { this.socket.recentsUpdatedListener = handler; }; +SoundTouchAPI.prototype.setZoneUpdatedListener = function(handler) { + this.socket.zoneUpdatedListener = handler; +}; + /* ****** UTILITY METHODS *********** */ diff --git a/sample.js b/sample.js index c094478..4e8d8e1 100644 --- a/sample.js +++ b/sample.js @@ -45,5 +45,9 @@ soundTouchDiscovery.search(function(deviceAPI) { console.log("NOW SELECTION UPDATED", json); }); + deviceAPI.setZoneUpdatedListener(function(json) { + console.log("ZONE UPDATED", json); + }); + soundTouchDiscovery.stopSearching(); }); \ No newline at end of file