Refresh model every 1min

Hi, I am looking for solution how to refresh model every 1 min in app. That is the problem becouse i never know on which route i am and i cant reset my timer.

I found one sollution to set current controller on property in service and do it on every route. Service will just set interval every 1 min to send refresh action to current controller. Do you have better idea for this?

Will be great for every answer!

Do you want to run setupController like below with cleared models. Not sure what refresh should do.

Perhaps you can make use of https://github.com/chrisfarber/ember-breadcrumbs

Hi, You may want to reach for the awesome ember-concurrency addon.

If you read this part of the docs, you will find an example that does what I think you are describing.

Since you mention that you want to do this in more than one route, you could create a mixin that has the ember-concurrency refresh code and mix it into the routes that should have that behavior.

Hope that helps!

2 Likes