I am looking for a solution to solve a state problem between models using backbone.js.
I have a time tracking application in which the user can start / stop tasks, and he will record the time of work. I have a job model that contains work data and whether it is currently 'on'.
Only one task can work at a time. Therefore, if a user starts a task, the current task must be stopped. I am wondering what is the best solution for this? I mean, I could just toggle each 'on' parameter and then call save on each, but this leads to 2 server requests, each of which has a complete view of each job.
Ideally, it would be great if I could copy additional data into a save request in the same way as you can send additional data to a fetch request. I only need to send the identifier of the current work, and since it is really not related to the model, it needs to be sent along with the model, not its part.
Is there a good way to do this? I think I could find a way to maintain a link to the current side of the job server if necessary: \
Groady
source share