Created
August 29, 2016 18:39
-
-
Save dpawluk/912905413e8cbd04a15a0133cb84fe28 to your computer and use it in GitHub Desktop.
Thanks Sam!
This file contains hidden or 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
| (function() { | |
| return { | |
| events: { | |
| 'app.activated': 'init', | |
| 'ticket.requester.id.changed': 'onRequesterChanged' | |
| }, | |
| init: function() { | |
| this.switchTo('main'); | |
| console.log(this); | |
| }, | |
| onRequesterChanged: function() { | |
| var self = this; | |
| setTimeout(function(){ // Without setTimeout there is a race condition unless lotus has data cached | |
| console.log(self.getUser().email()); | |
| }, 1000); | |
| }, | |
| getUser: function() { | |
| switch(this.currentLocation()){ | |
| case "user_sidebar": | |
| var userData = this.user(); | |
| return userData; | |
| default: | |
| var requesterData = this.ticket().requester(); | |
| return requesterData; | |
| } | |
| } | |
| }; | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment