Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (fail)
Viewing all articles
Browse latest Browse all 21

Alloy - Ti.App.fireEvent() not firing

$
0
0

I'm attempting to implement a solution devised by Mauro Parra for closing a tab's child windows. However, the fireEvent() method I use isn't firing in my onClick listener so I can't get to the point of debugging how to close child windows. grrr.

So, first things first. My onClick listener in home.js:

logOutButton.addEventListener('click', function(e) {
 
    Cloud.Users.logout(function(e) {
        if (e.success) {
            Ti.App.fireEvent('app:closeChildWindows', Alloy.CFG.homeTab);
            doStuff();      
        } else {
            throwError();
        }
    });
 
});
For reference, the Alloy.CFG object contains this:
Alloy.CFG = {
    "homeTab" : $.homeTab
};
My app event in index.js:
Ti.App.addEventListener('app:closeChildWindows', function(_tab) {
    if (_tab != null) {
        if (_tab.children) {
            Ti.API.info('Number of children: ' + _tab.children.length);
            for (var i = 0; i < _tab.children.length; i++) {
                do_clean(_tab, _tab.children[0]);
            }
        } else {
            return;
        }
    }
});
The logout listener works. I can log out successfully. However, I put a breakpoint on the fireEvent. In debug mode, the execution stops there. When I step into that event, the execution bypasses it right to the next task thus preventing me from even reaching the code to close the child windows.

Can someone help me understand what I'm doing incorrectly? Thanks.


Viewing all articles
Browse latest Browse all 21

Trending Articles



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