Skip to content

Instantly share code, notes, and snippets.

import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
export default class extends Component {
@service session;
@service myService;
@tracked value;
@tracked count = 0;
import Component from '@ember/component';
import Changeset from "ember-changeset";
import lookupValidator from "ember-changeset-validations";
import {
validatePresence
} from 'ember-changeset-validations/validators';
const ComponentValidations = {
email: [
validatePresence(true)
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import LoginValidations from '../validations/login';
import lookupValidator from 'ember-changeset-validations';
import { Changeset } from 'ember-changeset';
import MyChangeset from './my-changeset';
import { scheduleOnce, schedule } from '@ember/runloop';
export default class extends Component {
@tehmaestro
tehmaestro / components.child\.js
Last active January 22, 2021 14:01
New Twiddle
import Component from '@glimmer/component';
import { get, set, computed } from '@ember/object';
export default class extends Component {
// Why does this work? Isn't it like A.?
get firstArrayObject() {
return this.args.myArray[0];
}
// A. This does not work
import Component from '@ember/component';
import {computed} from '@ember/object';
export default Component.extend({
count: 0,
init() {
this._super(...arguments);
console.log('parent');
},
@tehmaestro
tehmaestro / components.child\.js
Last active January 21, 2021 21:56
New Twiddle
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { get } from '@ember/object';
export default class extends Component {
get isCountSet() {
return this.args.object.count;
}
get isTestSet() {
import Component from '@glimmer/component';
import { action, computed } from '@ember/object';
import { inject as service } from '@ember/service';
export default class extends Component {
@service alarms;
get currentAlarmsKey1() {
console.log('computed key 1');
return this.alarms.alarms['key1'];
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['classname-1', 'classname-2'],
classNameBindings: ['class4:classname-4'],
actions: {
// Add class3 using jquery
addClass3: function() {
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
destroyComp: function() {
this.destroy();
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
items: [],
i: 1,
isAnimating: false,
actions: {
addItem: function() {