Skip to content

Instantly share code, notes, and snippets.

Avatar

Jordan Hawker elwayman02

View GitHub Profile
@elwayman02
elwayman02 / controllers.application\.js
Last active Oct 8, 2020
Query Params Not Updating With Refresh
View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
View components.my-component\.js
import Component from '@ember/component';
import { assert } from '@ember/debug';
import { later } from '@ember/runloop';
export default Component.extend({
foo: null,
init() {
this._super(...arguments);
View components.masonry-demo\.js
import Component from '@glimmer/component';
export default class extends Component {
constructor() {
super(...arguments);
this.items = new Array(16);
}
}
@elwayman02
elwayman02 / components.checkbox\.js
Last active Aug 3, 2020
Yielded Nested Checkboxes
View components.checkbox\.js
import Component from '@glimmer/component';
export default class extends Component {
isIndeterminate = true;
toggleChildCheckbox(foo) {
this.toggleCheckbox(foo)
}
}
View components.my-component\.js
import Component from '@glimmer/component';
export default class extends Component {
get fooString() {
return JSON.stringify(this.args.foo);
}
get hasBar() {
return this.args.foo.hasOwnProperty('bar');
}
View components.dual-list\.js
import Component from '@glimmer/component';
export default class extends Component {
}
@elwayman02
elwayman02 / components.my-component\.js
Created Jun 24, 2020
Splattributes in ABC vs Classic
View components.my-component\.js
import Component from '@glimmer/component';
export default class extends Component {
}
View components.double-conditional-yield\.js
import Component from '@glimmer/component';
import { action, set } from '@ember/object';
export default class extends Component {
showSecondYield = false;
@action
toggleSecondYield() {
set(this, 'showSecondYield', !this.showSecondYield);
}
View components.my-component\.js
import Component from '@glimmer/component';
export default class extends Component {
}
View components.my-component\.js
import Component from '@glimmer/component';
import { computed } from '@ember/object';
import { inject as service } from '@ember/service';
export default class MyComponent extends Component {
@service('router') router;
@computed('args.foo', 'router.currentRouteName')
get routeMatch() {
return this.args.foo === this.router.currentRouteName;
You can’t perform that action at this time.