Tagged Questions
0
votes
0answers
21 views
Node.js: Is this factory method a good approach?
We are beginning to learn Node.js and we are not always sure if we do it the right way. We have a strong object oriented background so the adoption is not always easy. Right now we implemented a ...
1
vote
2answers
40 views
functional javascript - how could I generalize this code that correlates parallel async requests with their results?
/**
* takes a list of componentIDs to load, relative to componentRoot
* returns a promise to the map of (ComponentID -> componentCfg)
*/
function asyncLoadComponents (componentRoot, components) ...
1
vote
0answers
245 views
Simple Telnet Chat Server nodejs (correct way to write programs in node.js (asynchronous programming model))
I am new to node.js and asynchronous programming and this is my first small project to learn it. I have written a small Telnet Chat server and the program works but I want to know if this is the ...
1
vote
1answer
120 views
Calling a function when all asynchronous calls complete
Below is a simplified version of some code I am using to execute a function after all asynchronous calls complete. Is this a reasonable piece of code? It seems to work. Nothing would break if ...
0
votes
1answer
36 views
Processing a collection of objects, one at a time, with an asynchronous method.
I currently use setInterval and a wait flag to process this collection. Is there a cleaner way?
var wait = false;
var processInterval = setInterval(function(){
if(!wait){
var currentVideo ...
1
vote
1answer
308 views
Node.js Nested Callbacks, multiple requests
I'm making requests to Parse.com to 3 different objects that are needed to render a View.
I'd like to know what's the general/best approach in cases like these in which there are multiple requests ...
1
vote
0answers
182 views
Node.js asynchronous code design
I am writing a lightweight JSON api, and I come from a PHP background, so I have some questions/reviews about async node.js code.
This is my code so far:
main.js
var http = require('http');
var api ...
1
vote
2answers
105 views
A server response written in node/express/mongodb: does this look right?
This is my very very very first attempt to write anything meaningful in node. The client side is a simple form that has login, workspace, and simply saves them onto the database. It would have been a ...
2
votes
1answer
3k views
Loading your Javascript files asynchronous, jQuery defered vs native javascript
I need to get some script from the different social networking site, and I want to cache them. Not I want the function to be asynchronous, and non-blocking.
I have settled with a script, but I am not ...
4
votes
2answers
799 views
Async, callbacks, and closures — am I doing it right?
After having spent a month or two trying to learn JavaScript, especially functional programming, async, and closures, I finally get it. But I don't know if I'm writing elegant code... Specifically, ...