hobbyquaker / lgtv2

Control LG WebOS TV using node.js :tv:
MIT License
334 stars 44 forks source link

Status getter #5

Closed merdok closed 6 years ago

merdok commented 7 years ago

Added status getter. I think a status getter is needed to tell if the TV is turned on or off.

hobbyquaker commented 7 years ago

still thinking if we really need this - I would suggest to use the connect and close events to keep track on the connection status. Example:

var lgtv = require("lgtv2")();
var tvConnected;
lgtv.on('close', function () {
    tvConnected = false;
});
lgtv.on('connect', function () {
    tvConnected = true;
});
merdok commented 7 years ago

That is true, the events could be also used for keeping track of the connection status, but i was thinking that it would be better to use the internal connection property since it is already anyway there and has the needed information to tell the current tv status.