As you apply API level event listeners throughout your application you must remember to remove the event when you are done with it, usually when the window is closed. Otherwise your events will end up firing multiple times and things can get messy. Especially if a sql query is part of the call. These stray event listeners are also known as “zombie event listeners”.
The object below can help you manage your events and you will never have to worry about removing them. Any event listener you add with this wrapper will automatically get removed when the window is closed. It is essentially a wrapper for Ti.API.addEventListener and allows you to assign an event to a specific window.
This is a basic commonjs module.