Last active
October 30, 2017 18:36
-
-
Save kbshl/4107f3329c79fca98415 to your computer and use it in GitHub Desktop.
Titanium Mobile: Using JS-only event dispatcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dispatcher = require('dispatcher'); | |
function onLogOutButtonClick(e) { | |
dispatcher.trigger('logout'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dispatcher = require('dispatcher'); | |
dispatcher.on('logout', function onLogOut(e) { | |
// so the dispatcher doesn't keep us from GC | |
dispatcher.off('logOut', onLogOut); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment