samedi 24 décembre 2016

Where do I put my WebSocket code and how to pass its data to a template

I have a small application that I want to try to implement using Ember.js, but I'm not really sure what the best way to do it is.

The application is just supposed to take bids from a user and when a countdown reaches 0, it prints out that the highest bidder has won.

I'm wondering where to put the code for my WebSocket that receives data from a server and how to pass the data received to the template. I read that the data should be passed in the route's model, but I'm not sure how.

Right now I actually have implemented most of it, but most of the html is just put into my index.hbs file, and then I do all the logic with the websockets and changing the values of the html elements inside a script tag also in index.hbs. This just feels like a terrible way to do it, so I would like to know how to utilize some of the features of Ember.js to improve it.




Aucun commentaire:

Enregistrer un commentaire