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 STATES = ['REJECTED', 'APPROVED', 'REQUESTED']; | |
function getRandomState() { | |
return STATES[Math.floor(Math.random() * STATES.length)]; | |
} | |
export default Ember.Controller.extend({ | |
appName: 'Ember Array CP', |
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 { task, timeout } from 'ember-concurrency'; | |
const DEBOUNCE_TIME = 400; | |
function xhrUpdate(data) { | |
return new Promise(function(resolve) { | |
Ember.run.later(() => resolve(data.isActive), 1300); | |
}); | |
} |
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'; | |
function xhrUpdate(data) { | |
return new Promise(function(resolve) { | |
Ember.run.later(() => resolve(data.isActive), 1300); | |
}); | |
} | |
export default Ember.Controller.extend({ | |
appName: 'Ember.run.debounce', |
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 { task, timeout } from 'ember-concurrency'; | |
const counters = { | |
enqueue: 0, | |
restartable: 0, | |
drop: 0, | |
}; | |
function fetch(type) { |
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({ | |
classNames: ['my-component'], | |
didRender() { | |
console.log('didRender'); | |
} | |
}); |
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', | |
xhr: Ember.inject.service(), | |
init() { | |
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'; | |
export default Ember.Component.extend({ | |
isOpen: false, | |
init() { | |
this._super(...arguments); | |
setTimeout(() => { | |
console.log('3 seconds later...'); |
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 TOOLBAR_OPTIONS = [ | |
['bold', 'italic', 'underline'], | |
[ | |
{'list': 'ordered'}, | |
{'list': 'bullet'}, | |
{'script': 'sub'}, | |
{'script': 'super'}, | |
'link', |
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 { Component, computed } = Ember; | |
export default Component.extend({ | |
tagName: 'button', | |
type: 'button', | |
classNames: ['accordion-item__header'], | |
attributeBindings: ['type', 'aria-expanded', 'aria-controls'], | |
'aria-expanded': computed('isExpanded', 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({ | |
input(e) { | |
// The `mut` helper changes the `appName` value to what | |
// is provided as the `action` argument. | |
this.get('onNewValue')(e.target.value); | |
} | |
}); |