2

I was trying to add some delay to the response in Pusher

code

Pusher.logToConsole = true;
            var message;
            var pusher = new Pusher('someKeykjhkjklhl', {
              cluster: 'eu',
              encrypted: true
            });

            var channel = pusher.subscribe('my-channel');
            channel.bind('fileUploadJob', function(data) {
                 setTimeout(showMessage(data), 3000);

            });

            function showMessage(data)
            {
                    toastr.success(data.message,{ fadeAway: 1000 });

            }

but it is just working like normal

Thanks

Vikram Anand Bhushan
  • 4,836
  • 15
  • 68
  • 130

1 Answers1

3

try this:

channel.bind('fileUploadJob', function(data) {
    setTimeout(function() { showMessage(data) }, 3000);
});

Reference: https://stackoverflow.com/a/3800526/3475350 this link will tell you what actually happened.

Community
  • 1
  • 1
Abdul Rafay
  • 787
  • 6
  • 21