Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Is it possible to remove event listener on a different controller

$
0
0

I am setting up an event listener on one controller and I'd like to remove the listener on a different controller. Can I make the function public? if so how? Or does someone have an alternate solution to remove the eventlistener without moving the function?

index.js

if (!Ti.App.Properties.hasProperty('initialAppLoad')) {
 
    Ti.App.addEventListener('errorLoadingData', NetworkErrorOccured);
 
    Ti.App.Properties.setString('initialAppLoad', 'true');
}
 
function NetworkErrorOccured()
{
    // Perform something here
 
}
master.js
$.master.addEventListener('open', function(e) {
    start();
});
 
function start() 
{
    var helper = require('/helper');
    var returnval = helper.getData("http://somewebserviceurl");
 
    if(returnval)
    {
        $.master.close();
        Ti.App.fireEvent('errorLoadingData');
    }
    else 
    {
        // Remove NetworkErrorOccured event listener here, how?
 
    }
}

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>