Last active
March 22, 2017 08:15
-
-
Save feanor07/459655ad53231fb16775ac27198b9e73 to your computer and use it in GitHub Desktop.
patlama
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'; | |
export default Ember.Component.extend({ | |
myX: Ember.computed('item.computedX', function(){ | |
let result = this.get('item.computedX'); | |
return result; | |
}), | |
myY: Ember.computed('item.computedY', function(){ | |
let result = this.get('item.computedY'); | |
return result; | |
}), | |
}); |
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 {computed} = Ember; | |
let fp = Ember.Object.extend({ | |
d: 'd', | |
/*fpX: computed.alias('component.computedProperty.x'), | |
fpY: computed.alias('component.computedProperty.y'), | |
fpZ: computed.alias('component.computedProperty.external'),*/ | |
fpXBinding: 'component.computedProperty.x', | |
fpYBinding: 'component.computedProperty.y', | |
fpZBinding: 'component.computedProperty.external', | |
}); | |
export default Ember.Component.extend({ | |
init() { | |
this._super(...arguments); | |
this.set('fp', fp.create({component:this})); | |
}, | |
computedProperty:Ember.computed('item.x','item.y', 'externalField', function(){ | |
return {'x': this.get('item.x'), 'y': this.get('item.y'), | |
'external': this.get('externalField')} | |
}), | |
actions: { | |
onupdateX(value) { | |
this.get('item').set('x', value); | |
}, | |
onupdateY(value) { | |
this.get('item').set('y', value); | |
}, | |
onexternalupdate(value) { | |
this.set('externalField', value.z); | |
} | |
} | |
}); |
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'; | |
export default Ember.Component.extend({ | |
computedProperty:Ember.computed('item.z', function(){ | |
let z = {'z': this.get('item.z')}; | |
this.get('onexternalupdate')(z); | |
return z; | |
}), | |
actions: { | |
onupdateZ(value) { | |
this.get('item').set('z', value); | |
}, | |
} | |
}); |
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'; | |
let item = Ember.Object.extend({ | |
computedProperty: Ember.computed('x', 'y', function(){ | |
return {x: this.get('x'), y:this.get('y')} | |
}) | |
}); | |
export default Ember.Controller.extend({ | |
item: item.create(), | |
init() { | |
this.set('fp', Ember.Object.create({ | |
item: this.get('item'), | |
/*computedXBinding: 'item.computedProperty.x', | |
computedYBinding: 'item.computedProperty.y'*/ | |
computedX: Ember.computed.alias('item.computedProperty.x'), | |
computedY: Ember.computed.alias('item.computedProperty.y') | |
})); | |
Ember.defineProperty(this.get('item'), 'computedX', Ember.computed.alias('computedProperty.x')); | |
Ember.defineProperty(this.get('item'), 'computedY', Ember.computed.alias('computedProperty.y')); | |
}, | |
actions: { | |
computedChanged(property, value) { | |
this.set(property, value); | |
} | |
} | |
}); |
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
{ | |
"version": "0.12.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment