Last active
December 29, 2017 20:48
-
-
Save averydev/3fa031935b00ee5e965da68df9ad75f2 to your computer and use it in GitHub Desktop.
Async of Swim: basic case. Replace route with Ember Concurrency Task
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 *(){ | |
let blog = yield this.get('store').queryRecord('blog', {today:true}); | |
return blog; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment