Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Thoburn runspired

View GitHub Profile
View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
myValues = ["1", "2", "3"];
}
View pods migration
/* eslint-disable no-console */
import execa from "execa";
import { globby } from "globby";
import codeshift from "jscodeshift";
import fs from "node:fs";
import path from "node:path";
const TYPES = [
{ fileName: "adapter", usePods: false },
{ fileName: "component", usePods: false, alsoMoveTemplate: true },
View controllers.application\.js
import Controller from '@ember/controller';
import Model from '../models/foo';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
View components.my-component\.js
import Component from '@ember/component';
import { action } from "@ember/object";
export default Component.extend({
foo: "1",
myAction: action(function() { console.log(this); alert("hi"); }),
});
View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
View controllers.application\.js
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { dependentKeyCompat } from '@ember/object/compat';
export default class ApplicationController extends Controller {
@service store;
appName = 'Ember Twiddle';
View components.select.x-day\.js
import Component from '@glimmer/component';
import { action } from "@ember/object";
const ThirtyMonths = new Set([
4,
6,
9,
10,
]);
View components.uses-resource\.js
import Component from '@glimmer/component';
import { tracked } from "@glimmer/tracking";
import { cached } from "ember-cached-decorator-polyfill";
class Resource {
@tracked named = null;
@tracked positional = null;
constructor(update) {
@runspired
runspired / components.my-component\.js
Last active Jan 31, 2022
Async Getter as a State Machine Pattern
View components.my-component\.js
import Component from '@glimmer/component';
import { tracked } from "@glimmer/tracking";
import { cached } from "ember-cached-decorator-polyfill";
async function fetchData(searchTerm) {
const data = [];
for (let i = 0; i < 10; i++) {
data.push({
name: `Term: <${searchTerm}> search result ${i + 1}`,
});
View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
count = 124479;
error = null;
constructor() {
super(...arguments);
const Arr1 = [];