Last active
August 1, 2018 20:58
-
-
Save pzuraq/9bfa2297fefbe0a6686f487945595a08 to your computer and use it in GitHub Desktop.
New Twiddle
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 Component from '@ember/component'; | |
import { or, readOnly } from '@ember/object/computed'; | |
import { observer } from '@ember/object'; | |
export default Component.extend({ | |
unwrappedApi: or('api.api', 'api'), | |
foo: readOnly('unwrappedApi.foo'), | |
bar: readOnly('foo.bar'), | |
fooObserver: observer('bar', function() { | |
console.log('bar changed'); | |
}) | |
}); |
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 Controller from '@ember/controller'; | |
import { computed } from '@ember/object'; | |
export default Controller.extend({ | |
api: computed(() => { | |
return { | |
api: { | |
foo: { | |
bar: 123, | |
}, | |
}, | |
}; | |
}), | |
actions: { | |
updateApi() { | |
this.set('api', { | |
api: { | |
foo: { | |
bar: 456, | |
}, | |
}, | |
}); | |
}, | |
}, | |
}); |
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.15.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "release", | |
"ember-template-compiler": "release", | |
"ember-testing": "release" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment