On Thu, Nov 13, 2014 at 2:37 PM, Alex Spencer <[email protected]> wrote:

> But if a user hits Refresh (F5) twice instantly for example, I only want
> the code to run once.


There's not a system on the planet that will make that work the way you
want it to.

Once they hit refresh they have broken the connection to the backend. It's
not the same connection any more (well it might be under very certain
circumstances but let's not get into that).

Now you *might* be able to detect when/if that connection breaks and stop
processing further API calls (but detecting broken connections isn't always
trivial), but still you have to run all those API calls for the last
request.

Your best (perhaps only) way around this is to use AJAX on the front end
and have the front-end make those API calls individually to individual
endpoints.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAPJ5V2YrByawL7b-j9hB%3D454Y%2BdO6XPoXe8yi9%3DG_R%2BixtGo5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to