Player APIs (BrightScript & Ja...
JavaScript APIs
networkhotplug
5min
the networkhotplug object can be used to generate events when a ronetworkconfiguration docid\ u6zceyqddlz9xdakttmjs becomes available or unavailable a networkhotplugevent will be generated, indicating the interface and whether it was attached or detached reconfiguring a network interface may cause it to detach and attach again a dhcp address renewal may cause an event, even if the ip address hasn't changed networkhotplug idl interface networkhotplugevent { attribute string type; attribute bool attached; // 1 > attached, 0 > detached attribute string interfacename; }; callback networkhotplugeventcallback = void (networkhotplugevent event); interface networkhotplug { void addeventlistener(string type, networkhotplugeventcallback callback); void removeeventlistener(string type, networkhotplugeventcallback callback); }; event creation to create a networkhotplug event, load the @brightsign/networkhotplug module using the node js® require() method let networkhotplugclass = require("@brightsign/networkhotplug"); let networkhotplug = new networkhotplugclass(); networkhotplug use this interface to configure a networkhotplug event networkhotplugevent this event is raised when the hotplug status changes use the addeventlistener() method to listen for this event, or the removeeventlistener() method to remove an event listener networkhotplugevent properties type string string add or remove an event listener when this type of event occurs attached bool bool can be true or false (1 is attached, 0 is detached) interfacename string string returns the interface name (for example, "eth0") example let networkhotplugclass = require("@brightsign/networkhotplug"); let networkhotplug = new networkhotplugclass(); networkhotplug addeventlistener("networkhotplugevent", onnetworkhotplugevent); function onnetworkhotplugevent(data) { if (data attached) { // connected on 'data interfacename' } }