This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from "@glimmer/component"; | |
import { tracked } from "@glimmer/tracking"; | |
import { action } from "@ember/object"; | |
class Cell { | |
@tracked value; | |
constructor(key, value) { | |
this.key = key; | |
this.value = value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { ArrayProxy, set } = Ember; | |
const CustomArrayProxy = ArrayProxy.extend({ | |
destroy() { | |
set(this, 'content', []); | |
this._super(...arguments); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const values = [ | |
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 | |
]; | |
export default Ember.Controller.extend({ | |
sliderIndex: 1, | |
values: Ember.computed('sliderIndex', function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
length: 6, | |
originalVal: '', | |
arrayVal: Ember.computed('originalVal', function() { | |
const origin = this.get('originalVal').toString(); | |
const len = this.get('length'); | |
let arr = new Array(len); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
var fib = function(n){ | |
switch(n){ | |
case 0: return 0; | |
case 1: return 1; | |
default: return fib(n-1) + fib(n-2); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { computed } = Ember; | |
const { readOnly } = computed; | |
export default Ember.Component.extend({ | |
cost: readOnly('delayedCalculation.cost'), | |
tax: readOnly('delayedCalculation.tax'), | |
// One way to clear up the problem is to use the below CP definitions instead of the readOnly macros | |
// cost: computed('delayedCalculation.cost', function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
tagName: '', | |
init() { | |
this.set('tagName', 'div'); | |
this._super(); | |
}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import f from '../templates/components/foo-bar'; | |
import b from '../templates/components/foo-baz'; | |
export default Ember.Component.extend({ | |
init() { | |
this._super(...arguments); | |
if (this.cond) { | |
this.layout = f; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle' | |
}); |
NewerOlder