Titanium Mobile: Using JS-only event dispatcher
var dispatcher = require('dispatcher');
dispatcher.on('logout', function onLogOut(e) {
// so the dispatcher doesn't keep us from GC
dispatcher.off('logOut', onLogOut);
});
var dispatcher = require('dispatcher');
function onLogOutButtonClick(e) {
dispatcher.trigger('logout');
}