Skip to content
Advertisement

Tag: promise

socket.io – socket.on wait for promise

I have a button that does some communication with the server to check if an entered value (via an input box) already exists. The code is the following: The problem is that the checkReturn call is asynchronous, and therefore the code carries on without actually waiting for the result. How do I make sure that checkReturn is first finished and

What happens if i reject / resolve multiple times in Kriskowal’s q?

I’m studying the promises pattern and using kriskowal’s q for node.js, having this snippet: What if both the parser fails and some_reason is true? Will the execution procede from rejecting through resolving and both promise’s method be called at different times, thus generating a bug? Should i avoid to call reject/resolve multiple times? Answer Since promises can only resolve once

Advertisement