The problem I went through began when I needed to run more actions after some api call and since everything is based on callbacks I could see the callback hell pattern coming.
I am using AngularJS a lot these days, some weeks back I was reading the $http object documentation and how it is built with the promise/defer solution. Turned out that I wanted to apply that to my Facebook code, I didn’t want to depend on many other libraries (nhé, it depends on underscorejs anyways…) so I wrote my own defer/promise implementation. Of course I read some references before writing it and I recommend that you make use of some proved working frameworks, like Q.
Well, it was nice to challenge myself to write the wrapper and you can use it by your own risk: Facebook Wrapper
… you can simply instatiate the object to see the available methods (you need to load FB SDK before doing so):
… you can also use my Defer/Promise implementation if you want, it works sort of like this:
1 2 3 4 5 6 7 8 9 10