Skip to content

Instantly share code, notes, and snippets.

import Controller from '@ember/controller';
export default class TestController extends Controller {
// Remove this, and derived starts working
// model;
get derived() {
return "The model is " + this.model;
}
}
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { assert } from '@ember/debug';
export default class TestComp extends Component {
// constructor() {
// super(...arguments)
// assert('testValue must be passed in', this.args.testValue);
// }
@pzuraq
pzuraq / components.my-component\.js
Last active November 6, 2020 00:12
New Twiddle
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
export default class extends Component {
@service router;
get qp() {
return this.router.currentRoute.queryParams.qp || 1;
}
import Component from '@glimmer/component';
export default class extends Component {
}
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
if = false;
}
@pzuraq
pzuraq / autotracking.js
Last active December 13, 2023 22:57
Autotracking Simplified
// The global revision clock. Every time state changes, the clock increments.
let $REVISION = 0;
// The current dependency tracker. Whenever we compute a cache, we create a Set
// to track any dependencies that are used while computing. If no cache is
// computing, then the tracker is null.
let CURRENT_TRACKER = null;
// Storage represents a root value in the system - the actual state of our app.
class Storage {
@pzuraq
pzuraq / ceds.md
Created March 27, 2022 18:17
Class Element Definitions

Class Element Definitions

Stage: 0

Class element definitions (CEDs) are a proposal for extending JavaScript classes with a syntax that mirrors the behavior of Object.defineProperty.

class C {
  x {
 configurable = true;