Skip to content

Instantly share code, notes, and snippets.

@dpawluk
Created August 29, 2016 18:39
Show Gist options
  • Select an option

  • Save dpawluk/912905413e8cbd04a15a0133cb84fe28 to your computer and use it in GitHub Desktop.

Select an option

Save dpawluk/912905413e8cbd04a15a0133cb84fe28 to your computer and use it in GitHub Desktop.
Thanks Sam!
(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