Last active
August 29, 2015 14:13
-
-
Save poteto/7b997a249d9fb69b6aa0 to your computer and use it in GitHub Desktop.
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
import Ember from 'ember'; | |
import notifyParents from 'notify-parents'; | |
var observer = Ember.observer; | |
var computed = Ember.computed; | |
var not = computed.not; | |
var get = Ember.get; | |
export default Ember.Object.extend({ | |
firstName: 'Lauren', | |
lastName: 'Tan', | |
isAtHome: false, | |
isOutside: not('isAtHome'), | |
fullName: computed('firstName', 'lastName', function() { | |
return get(this, 'firstName') + ' ' + get(this, 'lastName'); | |
}), | |
notifyParentsWhenAtHome: observer('isAtHome', function() { | |
var userIsAtHome = get(this, 'isAtHome'); | |
if (userIsAtHome) { | |
notifyParents(get(this, 'fullName'), new Date()); | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment