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', | |
on:false, | |
simpleOn:false, | |
actions:{ | |
click(){ | |
console.log("Click!"); | |
}, |
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 Concurrency Decendants' | |
}); |
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
// In your route... | |
import Route from '@ember/routing/route'; | |
import { task } from 'ember-concurrency'; | |
export default Route.extend({ | |
model: function (){ | |
return { | |
blog: this.get('blogTask').perform() | |
}; | |
}, | |
blogTask: task(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
// routes/blog/comments.js | |
model: function (params){ | |
return { | |
comments: this.get('commentsTask').perform() | |
}; | |
}, | |
commentsTask: task(function *(){ | |
let blog = yield this.modelFor('blog').blogTask; | |
let comments = yield blog.get('comments'); | |
return comments; |
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
//In your route | |
import Route from '@ember/routing/route'; | |
import { task } from 'ember-concurrency'; | |
export default Route.extend({ | |
model: function (params){ | |
return { | |
blog: this.get('blogTask').perform(params.blog_id)}; | |
}, | |
blog: task(function *(blogId){ | |
let blog = yield this.get('store').findRecord('blog', blogId ); |
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
commentsTask: task(function *(){ | |
let blog = yield this.modelFor('blog').blogTask; | |
let comments = yield blog.get('comments'); | |
return comments; | |
}).cancelOn('deactivate') |
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' | |
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 () => { | |
let foo = [1,2,3] | |
let output = foo.map( f => `.rule-${f}: { border-width:${f}px;}); | |
return output; | |
} | |
/** Result | |
* [".rule-1: { border-width: 1px };", | |
* ".rule-2: { border-width: 2px };" | |
* ".rule-3: { border-width: 1px };"] |