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 PromisableObjectProxy = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin); | |
export default function(...args) { | |
const fn = args.pop(); | |
const dependentKeys = args.slice(); | |
return Ember.computed(...dependentKeys, function() { | |
const promise = fn.apply(this); |
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 slice = Array.prototype.slice; | |
const PromisableObjectProxy = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin); | |
export default function(...args) { | |
const fn = args.pop(); | |
const dependentKeys = args.slice(); | |
return Ember.computed(...dependentKeys, 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'; | |
const slice = Array.prototype.slice; | |
const computedPromise = function() { | |
const fn = slice.apply(arguments, [arguments.length-1, arguments.length])[0]; | |
const dependentKeys = slice.apply(arguments, [0, arguments.length-1]); | |
return Ember.computed(...dependentKeys, function() { | |
const PromisableObjectProxy = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin); |
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 isNone from 'ember-metal/is_none'; | |
import run from 'ember-metal/run_loop'; | |
var originalSetTimeout = window.setTimeout; | |
var originalDateValueOf = Date.prototype.valueOf; | |
function wait(callback, maxWaitCount) { | |
maxWaitCount = isNone(maxWaitCount) ? 100 : maxWaitCount; | |
originalSetTimeout(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({ | |
didInitAttrs() { | |
this.set('status', 'inactive'); | |
}, | |
startCounting() { | |
this.setProperties({status: "running", startDate: new Date()}); | |
this.updateValue() | |
}, |
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 genericSelectOptPath = function([opt, path]) { | |
if (path) { | |
return opt.get(path); | |
} else { | |
return opt; | |
} | |
}; |
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
export default Ember.Route.extend({ | |
beforeModel() { | |
this.get('currentUser').fetchCurrentUser().then(()=>{ | |
// do stuff | |
}); | |
} | |
}) |
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 { moduleForComponent, test } from 'ember-qunit'; | |
import hbs from 'htmlbars-inline-precompile'; | |
moduleForComponent('play-pause-toggle', 'Integration | Component | play pause toggle', { | |
integration: true | |
}); | |
test('it renders', function(assert) { | |
assert.expect(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
#home | |
.container | |
%ul.episodes | |
- each model as |episode index| | |
%li | |
-if episode.playing | |
%a.play(href="/pause" ){action "pause"} | |
.play-button | |
=fa-icon "pause" | |
-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'; | |
import { MousetrapRoute, mousetrap } from 'ember-mousetrap'; | |
export default Ember.Route.extend(MousetrapRoute, { | |
player: Ember.inject.service('player'), | |
shortcuts: { | |
togglePlay: mousetrap('space', function(e){ | |
var player = this.get('player'); | |
if(player.get('playing')){ | |
} else { |