Last active
June 10, 2016 15:04
-
-
Save sultaniman/97657ed79ea375b87831efc4a12906b6 to your computer and use it in GitHub Desktop.
prop function
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
| import Ember from 'ember'; | |
| const {on, get} = Ember; | |
| let prop = function(key) { return get(this, key) }; | |
| export default Ember.Component.extend({ | |
| onElementInsert: on('didInsertElement', function() { | |
| // In this place we just bind components context | |
| // to a `prop` function | |
| prop = prop.bind(this); | |
| }), | |
| _doSomething() { | |
| // use it | |
| let getSomething = prop('something'); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment