How can i remove the event listener form a newSwitch ?
local function onSwitchPress( event ) local switch = event.target print("witch Press") -- remove event listener ?? end local onOffSwitch = widget.newSwitch { x = dpw - dpw/2, y = dph - dph/2, style = "onOff", id = "onOffSwitch", onPress = onSwitchPress } onOffSwitch:setState( { isOn=true, isAnimated=true} )