Skip to content

Instantly share code, notes, and snippets.

View NullVoxPopuli's full-sized avatar

NullVoxPopuli

View GitHub Profile
@NullVoxPopuli
NullVoxPopuli / components.item-component.js
Last active November 29, 2023 09:30
didInsertElement Example
import Component from '@ember/component';
export default class ItemComponent extends Component {
didInsertElement() {
console.log(`item ${this.item} was inserted`);
}
}

RFC#570: Background, motivation, reasoning.

Converting an addon to the v2/native format is described in detail here

NOTE: "v2 addons" are also known as "native packages", "native addons", "npm native", etc.


benefits tl;dr:

  • Vite compatible (along with other packagers, rollup, etc)

What's new since Octane?

All of this will be part of what makes up the next edition, Polaris (which is still being defined and explored)

import React from 'react';
export const Foo = <>
test {expression + expression} test
{[].map(item => {
return <div>{item}</div>
})}
<div></div>
@NullVoxPopuli
NullVoxPopuli / controllers.application\.js
Last active August 12, 2021 14:59
QP-Only Transition Bug Reproduction
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class ApplicationController extends Controller {
queryParams = ['test'];
appName = 'Ember Twiddle';
@service router;
@NullVoxPopuli
NullVoxPopuli / controllers.application\.js
Last active July 25, 2021 16:25
Each Behavior -- Removal
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
export default class ApplicationController extends Controller {
@tracked records = freshArray();
@action addFirst() {
log('add:first, expect one each log');
this.records = [{ id: this.records.length + 1 }, ...this.records ];
<h2>Checkbox</h2>
<input
checked={{this.value}}
type='checkbox'
{{on 'input' this.handleInput}}
{{on 'change' this.handleChange}}
>
<button {{on 'click' this.changeValue}}>Change the value externally</button>
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}