ember-octane

Is it possible to make a route's model a computed / tracked property?

天涯浪子 提交于 2021-01-29 07:02:50
问题 I'm trying to have a route's model hook return some array that is constantly updated via a polling mechanism using Ember later. The route file looks like this: export default class IndexRoute extends Route { recent: [], init() { ... this.getRecent(); } getRecent() { // poll data / fetch latest this.recent.push(newStuff); later(this, this.getRecent, 2000); } model() { return this.recent; } } Then in my controller, I wanted to create a @computed / @tracked property based on the route's model :