/
JavaScript Event Handling
JavaScript Event Handling
AddEventListener
addEventListener()
is a common BrightSign method that is used to listen for an event.
Syntax:
target.addEventListener(type, listener);
type
string: Specifies the type of event to listen forlistener
function: The object to be notified when the event (of the specifiedtype
) happens
RemoveEventListener
removeEventListener()
is a common BrightSign method that is used to remove an event listener.
Syntax:
target.removeEventListener(type, listener);
type
string: Specifies the type of event to listen forlistener
function: The object to be notified when the event (of the specifiedtype
) 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);
, multiple selections available,
Related content
(3) What's Next?
(3) What's Next?
More like this
(3) Player Management
(3) Player Management
More like this
(1) Start Here
(1) Start Here
More like this
(3) Core Elements
(3) Core Elements
More like this
(2) Core Elements
(2) Core Elements
More like this
(1) Core Elements
(1) Core Elements
More like this