You are reading a single comment by @Mr.Peu and its replies. Click here to read the full conversation.
  • Hmm, I didn't know that was even possible - it feels a bit iffy - for instance if you're trying to serve up a file containing a JS function, if you try and serve up a variable containing the function rather than a variable containing a string representing the function, it'll get executed :s

    I'm pretty sure you can just use the 'close' event though?

    http.createServer(function (req, res) {
          //...
          res.on('close', function() {
            console.log('GET done.');
            digitalWrite(LED2,0);
          });
    }
    

    If you're interested, source of the HTTP module is here - it it's in C.

  • Hmm, I didn't know that was even possible - it feels a bit iffy - for
    instance if you're trying to serve up a file containing a JS function,
    if you try and serve up a variable containing the function rather than
    a variable containing a string representing the function, it'll get
    executed :s

    I'm not sure to understand what you mean. The callback is always the latest of the given arguments. If end(a), a() will be called. If end(a,b), b()... The type does not matter to tell which argument is what.

    I'm pretty sure you can just use the 'close' event though?

    I will try this.

    If you're interested, source of the HTTP module is here - it it's in C.

    Thanks. It will spare me to ask useless questions :)

About

Avatar for Mr.Peu @Mr.Peu started