class Foo {
@tracked bar;
get baz() {
return this.bar;
}
}
let foo = new Foo();
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.Controller.extend({ | |
appName: 'Ember 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 Ember from 'ember'; | |
import { computed } from '@ember/object'; | |
let count = 0; | |
export default Ember.Component.extend({ | |
count: computed('value', () => count++), | |
value: computed({ | |
get() { |
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 foo = Ember.computed({ | |
get() { return 'foo'; }, | |
set(key, value) { return value; }, | |
}); | |
class MyClass {} | |
Ember.defineProperty(MyClass.prototype, 'foo', foo); |
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
// Helper that has the router service injected as the first parameter. Benefits: | |
// | |
// 1. Still stateless, all state is owned by the service, so no possibility of bugs due to statefulness of the instance | |
// 2. Much easier to write, less boilerplate | |
// 3. Subjectively easier to read | |
// | |
function routeActive(router, [routeName]) { | |
return router.isActive(routeName); | |
} |

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
/** | |
* @module ember-paper | |
*/ | |
/* globals FastBoot */ | |
import { inject as service } from '@ember/service'; | |
import Component from '@ember/component'; | |
import { computed } from '@ember/object'; | |
import { run } from '@ember/runloop'; | |
import TransitionMixin from 'ember-css-transitions/mixins/transition-mixin'; | |
import { invokeAction } from 'ember-invoke-action'; |
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.Controller.extend({ | |
appName: 'Ember Twiddle', | |
foo: 0, | |
updateFoo() { | |
this.incrementProperty('foo') | |
} |
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({ | |
}); |