0
votes
1answer
42 views

Node.JS / Javscript Async Call back issue

I am trying to accomplish the following (should be quite basic and I must be missing something trivial): 1. Call a function with string that has a select statement 2. Wait until the DB call completes ...
2
votes
2answers
152 views

Node.js functions, objects and variables

I've just started with javascript and im still trying to get my head around how it works. Can you explain why this works serialPort.on("open", function () { console.log('open'); ...
2
votes
1answer
57 views

Why the execution context (“this”) of prototypical function is wrong in this example?

Prototypical function bar is executed elsewhere, in a Node.js environment (where bind should be available). I want this inside bar() function to be the instance of my object: var Foo = function (arg) ...
0
votes
2answers
98 views

Sending anonymous functions through socket.io?

I want to create a client-side function that can receive and execute arbitrary commands using client-side variables. I will be sending these functions from my server by using socket.io to send a JSON ...
0
votes
0answers
95 views

How are variables and references stored in anonymous functions in javascript?

I'm making a server in node.js (with socket.io), and this specific problem has been haunting me for the longest time now. I made an easily extendable handler for socket connections to route each ...
1
vote
2answers
64 views

Returning from anonymous function passed as parameter

Consider the following code: function dbTask(q) { mysql = new MySQL(); mysql.host = sqlHost; mysql.user = sqlUser; mysql.password = sqlPassword; mysql.query("USE stock"); ...
0
votes
1answer
124 views

Why is context inside non-interactive Function object different in node.js?

I'd like to create a function from string that requires another module (don't ask). When I try to do that in node interactive shell, everything is fine and dandy: > f = new Function("return ...
0
votes
2answers
187 views

How to Invoke anonymous javascript function on object in 1 line?

I am learning about javascript anonymous functions and scope and am trying to understand something but have become a bit stuck. I have the following three functions: var funcA = function (value) { ...
0
votes
1answer
182 views

Using factory methods as alternative to passing anonymous functions

I was watching a video on node.js and I saw the speaker say, he prefers to do this instead of using anonymous call backs: var server = Server.createServer(server.createReq(req,res)); I think its ...
1
vote
2answers
222 views

Anonymous function scope confusion

How can I assign values inside an anonymous function to global variables, or variables outside its scope. For instance, the example below. console.log(rows) returns the right data, while ...
3
votes
1answer
594 views

Anonymous functions and node.js performance

Are performance effects when using JavaScript anonymous functions also applicable for node.js programs when most of the code in the wild is network/http oriented and processing requests, connections ...
1
vote
1answer
55 views

Distinguish between Node's native functions and anonymous functions

I'm looking for a way to traverse through an object and perform an action if I have an anonymous function and not perform the action if I have a native function. This is best explained with an ...