Skip to content

How to implement callback in ngHistory in Pubnub? #5

@rinirinku

Description

@rinirinku

When trying to retrieve the history message in the on event , the loading time is too long. The spinner show and hides too fast. But the message is not yet loaded.

How can we calculate or get the exact time to make the history load?
$scope.limit = 100
PubNub.ngHistory( {
channel : $scope.channel,
limit : $scope.limit
});

$rootScope.$on(PubNub.ngMsgEv($scope.channel), function(ngEvent, payload) {

            **ActivityIndicator.showSpinner();**

                $scope.$apply(function(){
                $scope.messages.push(payload.message);
            });

            $(".messages-wrap").scrollTop($(".messages-wrap")[0].scrollHeight);
            **ActivityIndicator.hideSpinner();**

        }); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions