Skip to content

Instantly share code, notes, and snippets.

🤓
Code it!

Alex Kanunnikov lifeart

🤓
Code it!
Block or report user

Report or block lifeart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View demo.js
class Foo {
constructor () {
if (this.hasQuestion) {
alert(42);
}
}
}
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
rawRender: false,
refRender: false,
items: null,
actions: {
expand(name) {
this.set('items', new Array(200).fill(null)),
View components.my-link-to.js
@lifeart
lifeart / index.js
Created Jul 7, 2019
Accessing the Global App Object in an Ember CLI App
View index.js
const myApp = window.Ember.Application.byName('myApp').__container;
// https://emberigniter.com/accessing-global-object-in-ember-cli-app/
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
result: null,
actions: {
do() {
var hello = []
hello.push([])
@lifeart
lifeart / component.js
Created Jun 26, 2019
ember fragment rendering
View component.js
import Component from '@ember/component';
import { computed } from '@ember/object';
export default Component.extend({
internalTag: 'div',
internalClass: '',
init() {
this._super(...arguments);
this.fragment = document.createElement(this.internalTag);
if (this.internalClass) {
this.fragment.className = this.internalClass;
View components.performant-each.js
import Ember from 'ember';
export default Ember.Component.extend({
internalTag: 'div',
init() {
this._super(...arguments);
this.fragment = document.createElement(this.internalTag);
},
addFragmentToDom: Ember.computed(function(){
this.element.appendChild(this.fragment);
View components.performant-each.js
import Ember from 'ember';
export default Ember.Component.extend({
chunkedItems: Ember.computed('items', function(){
return this.items;
}),
fragment: document.createDocumentFragment(),
init() {
this._super(...arguments);
var observer = new MutationObserver(function(mutations) {
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
items: Ember.computed(function(){
let items = [{name: 'foo'},{name: 'boo'}];
return Ember.A(items);
}),
actions: {
replaceFirstObject() {
You can’t perform that action at this time.