Skip to content

Instantly share code, notes, and snippets.

ab-test.svg
academy.svg
account.svg
active.svg
activity.svg
add-column-left.svg
add-column-right.svg
add-macro.svg
add-participant.svg
add-row-above.svg
@patocallaghan
patocallaghan / components.alpha-panel\.js
Last active March 2, 2022 10:17
Component Inheritance
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class extends Component {
@tracked isOpen = false;
@action
togglePanel() {
this.isOpen = !this.isOpen;
@patocallaghan
patocallaghan / components.alpha-page\.js
Last active March 2, 2022 00:27
Updated controller
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class extends Component {
@tracked random = this.getRandom();
constructor() {
super(...arguments);
console.log('INIT: Alpha Page Component');
@patocallaghan
patocallaghan / controllers.alpha\.js
Last active March 2, 2022 00:13
Classic Controllers
import Controller from '@ember/controller';
import { action } from '@ember/object';
export default Controller.extend({
init() {
this._super(...arguments);
console.log('INIT: Alpha Controller');
this.set('random', this.getRandom());
},
import Controller from '@ember/controller';
export default Controller.extend({
init() {
this._super(...arguments);
console.log('INIT: Alpha Controller');
}
});
import Component from '@glimmer/component';
import { action } from '@ember/object';
export default class HtmlDemo extends Component {
@action
updateFirstName(event) {
// This will throw an error because this.args is not mutable
this.args.firstName = event.target.value;
}
}
import Component from '@ember/component';
export default Component.extend({
actions: {
updateLastName(event) {
this.set('lastName', event.target.value);
}
}
});
@patocallaghan
patocallaghan / input.scss
Created January 25, 2021 16:22
Generated by SassMeister.com.
$blue: #0000ff;
.parent {
.child {
background: $blue;
}
}
@patocallaghan
patocallaghan / input.scss
Last active January 25, 2021 16:25
Generated by SassMeister.com.
$blue: #0000ff;
.parent {
.child {
background: $blue;
}
}
@patocallaghan
patocallaghan / controllers.application\.js
Created August 13, 2020 08:57
HTML attributes and booleans
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}