gir.removeEventHandler

Top  Previous  Next

Once an event handler is no longer needed unregister it with this function. It is good practice to unregister event handlers once they are not needed anymore as they are processed every time an event arrives.

Definition

gir.removeEventHandler( handlerId )

 

Name

Type

Description

handlerId

number

This is the id returned by addEventHandler

Example

Below is an example that first registers an event handler. Once the event "StopMe" arrives the event handler unregisters.

 

local handlerId

handlerId = gir.addEventHandler(".*", 18, 18, function ( event, device, keyMod, payloads )      

 print(event, device)        

 if event == "StopMe" then

         gir.removeEventHandler( handlerId )

         handlerId = nil

 end

end)

Related

gir.addEventHandler

Availability

Lua