Skip to content

Instantly share code, notes, and snippets.

Avatar
🏁

Alex Speller alexspeller

🏁
View GitHub Profile
View controllers.application.js
import Ember from 'ember';
import { computed } from "@ember/object";
import { map } from "@ember/object/computed";
const Folder = Ember.Object.extend({
subArrays: map('subfolders', 'allChildren'),
allChildren: computed('subfolders.@each.allChildren', 'subArrays.@each.[]', function() {
let children = [];
this.get('subfolders').forEach(folder => {
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
filteredItems: [1,2,3],
unfilteredItems: [4,5,6]
});
View components.my-component.js
import Component from '@ember/component';
export default Component.extend({
});
View components.my-list.item.js
import Ember from 'ember';
import { next } from '@ember/runloop';
export default Ember.Component.extend({
didInsertElement() {
this.list.items.pushObject(this);
}
});
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'
});
View controllers.application.js
import Ember from 'ember';
const {computed} = Ember;
let aCount = 0;
let bCount = 0;
let stableComputedKey = 0;
function stableComputed(...dependentKeys) {
let func = dependentKeys.pop();
View controllers.application.js
import Ember from 'ember';
const {computed} = Ember;
let aCount = 0;
let bCount = 0;
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
value: 'initial',
@alexspeller
alexspeller / push-deletion.js
Created May 9, 2018 — forked from runspired/push-deletion.js
Useful Ember Data helpers
View push-deletion.js
/*
notifying the store that a record has been remotely deleted and should be fully removed.
*/
function pushDeletion(store, type, id) {
let record = store.peekRecord(type, id);
if (record !== null) {
let relationships = {};
let hasRelationships = false;
You can’t perform that action at this time.