Orchestration way


#1

Hi,

I am on the way to design an app who require to change route periodically.
In fact. When the “game” is started, if no action was called, after 30 seconds, the route must change to another one.

Now, I do not know if using a service is the right way.
However, I read about the RunLoop and the ember-routing service.

Alternatively, can I use one route to enjoy with more than one controller ?

Thanks for all your answers.

Kind regards,


#2

Perhaps use Ember.RSVP.hash and setupController: like this https://github.com/broerse/ember-cli-blog/blob/master/app/routes/posts.js to get multiple models in one controller. You can then change to a new slug after 30 seconds? If the routes are totally different games I think your idee of transitionTo routes after 30 seconds is better.


#3

Hi Broerse,
I never deal with RSVP.js, I will dig on this side.

The game work with eight kind of controllers corresponding of types of slide games.
At the beginning, I was thinking to use one route for those like /game/.

But it is an electron app ! So using many routes it is not a problem.
I think I will use a service to Orchestrate with the ember-routing service.

But… Can I inject for each controller the same service to build a two-way relation ?


#4

Yes you can inject a service on each controller. You can also if there is change in the games update a value with a time-stamp and write something that will transistionTo a random game (route) when the time-stamp is older then 30 seconds. You can create a global value on all controllers like this.


#5

I will try this !

Thank you for your help :slightly_smiling: