Player APIs (BrightScript & Ja...
JavaScript APIs

JavaScript Event Handling

5min
addeventlistener addeventlistener() is a common brightsign method that is used to listen for an event syntax target addeventlistener(type, listener); type string string specifies the type of event to listen for listener function function the object to be notified when the event (of the specified type ) happens removeeventlistener removeeventlistener() is a common brightsign method that is used to remove an event listener syntax target removeeventlistener(type, listener); type string string specifies the type of event to listen for listener function function the object to be notified when the event (of the specified type ) happens example function gpiocontroldown(msg){ console log(json stringify(msg)); console log(" gpio " + msg detail) } // to add an event listener for the "controldown" gpio event control port addeventlistener("controldown", gpiocontroldown); // to remove the "controldown" gpio event listener control port removeeventlistener("controldown", gpiocontroldown);