Search code examples
angularjsfacebook-graph-apipromiseprogress

Track progress of facebook graph api requests


I am willing to track the progress of the querying from Facebook's graph api. I have this promise in an angular service

getPosts: function() {
        var deferred = $q.defer();
        FB.api(
            "/me/home", {since:'yesterday','limit': limit},
            function ( response ) {
                if ( response && !response.error ) {

                    deferred.resolve(response);
                }
            }
        );
        return deferred.promise;  
    },

and in my controller I use FBS.getPosts().then(function (data) {...}); . I am willing to be able to keep track of the progress of this promise and be able to display it on my page. Any ideas if this is even possible? I tried adding function (progress) , after the error function of the promise in my controller, had no luck though. Somewhere I read you can use .progress(function (progress){...}) like the .then one but it didn't work.


Solution

  • I don't like leaving questions in the tag open as I've made is a personal goal to keep it clean :) so here goes:

    Facebook does not expose that functionality, if you want you can track the progress of multiple requests (that is, how many out of N requests are done) but that's not the same thing.

    What you are asking for is simply put - impossible. There is no way to know how far the query has progressed without Facebook telling you, and they're not telling you.

    Happy coding.