Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
Working on typelog.dev

Ilya Radchenko knownasilya

🐢
Working on typelog.dev
View GitHub Profile
View controllers.application\.js
import Controller from '@ember/controller';
const namedValues = (event) => {
const fields = Object.keys(event.target.elements).filter(key => Number.isNaN(parseInt(key, 10)))
const values = Object.fromEntries(fields.map(key => {
let element = event.target.elements[key];
let value = element.type === 'checkbox' ? element.checked : element.value
return [key, value];
}));
View components.my-component\.js
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
let index = 0;
export default class extends Component {
@tracked obj = {
index: 0
};
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View controllers.application\.js
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@knownasilya
knownasilya / README.md
Created Nov 22, 2019
state machines ember
View README.md
const machine = Machine({
  id: 'toggle',
  initial: 'inactive',
  states: {
    inactive: { on: { TOGGLE: 'active' } },
    active: { on: { TOGGLE: 'inactive' } }
  }
});
View README.md
Uncaught (in promise) Error: Undefined binding(s) detected when compiling SELECT query: select * from `user_site_sessions` where `userId` = ? and `url` = ?
    at HTMLElement.load (main.js:97)
    at new ExplorerApp (main.js:59)
    at drive-handler.js:3
View router.js
import EmberRouter from '@ember/routing/router';
import { inject as service } from '@ember/service';
import config from './config/environment';
export default class Router extends EmberRouter {
@service metrics;
@service router;
@service fastboot;
@service headData;