criso / fbgraph

NodeJs module to access the facebook graph api
http://criso.github.io/fbgraph/
1.09k stars 176 forks source link

[Enhancement] Specify context for callbacks #44

Closed billybonks closed 10 years ago

billybonks commented 10 years ago

i added functionality so that the callbacks from post and get are called in the specified context, added the documentation to the read me.

criso commented 10 years ago

This should be dealt with in userland. If you need access to the passed in access token, just wrap your call in a closure. http://stackoverflow.com/questions/2900839/how-to-structure-javascript-callback-so-that-function-scope-is-maintained-proper

billybonks commented 10 years ago

for what reason should the user of the lib have to write more lines of code for every call if we can solve the problem in a few lines that gets reused everytime ?

criso commented 10 years ago
  1. Adds complexity to the lib.
  2. This won't work as you expect with graph.setContext() this.context is static. While a requests are being fired, it can still get altered. Only way to ensure that it works correctly would be to pass it in the get call etc..
    • Not trying to be a dick. I get your point and I appreciate you taking time to improve the lib. I just don't believe the juice is worth the squeeze.
billybonks commented 10 years ago

np