Note that there are some explanatory texts on larger screens.

plurals
  1. POEvents in a collection/array
    primarykey
    data
    text
    <p>In my jQuery web app I'm using events pretty much.<br> My component for doing ajax client requests (the name is "comm") to the server has a queue.<br> This queue is similar to a Backbone.js collection. </p> <p>So every time I put a new request object into the collection of "comm", the comm object gets an "add" event and the "worker" method of "comm" looks, if there is currently an ongoing request. If there is no one, the worker method processes the request and finally, when everything works fine, triggers a "complete" event on the request object.</p> <p>In this comm component only one request at a time is possible. If I add an request object to "comm" and the "add" event gets triggered and the worker method sees, that there is already a request, than nothing happens. </p> <p>My question is: In this situation, what is the best approach for handling this unprocessed request object IN REGARD TO "AN EVENT INFRASTRUCTURE"?</p> <p>Until now I had 2 different approaches:</p> <p>1) I could do the following: If my ongoing request is finished, the worker method can check if there is an unprocessed request object in the collection and process it. This is simple, no event is envolved.</p> <p>2) Or something different: If the worker method starts due to an "add" event and sees, that there is already an ongoing request, I could implement something like: "I can not respond adeqately to this add event, I place you back. Please trigger yourself in 200 milliseconds again, maybe I have time then."</p> <p>Maybe somebody already had a similar problem and had a very good solution to this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload