Noty notification works only when Tab is in focus

108 Views Asked by At

I am using Noty library for showing notification in a web page.

That notification is fired with a signalr client callback from server.

What happens is, this notification is shown only when Chrome Tab is in active state. When I move out of that tab into some another tab,and if server message is received via signalr, other code runs fine like RefreshGrid, but noty notification does not come up. It shows when I again focus and switch back to that tab.

How to overcome this?

Following is the code for showing noty notification

HubProxy.client.shownotification = function (msg) {
    RefreshGrid(); //This is working fine whether tab is active or not
    new Noty({
        theme: globaltheme,
        type: msg.TYPE,
        layout: globalposition,
        text: '<i class="bi bi-check-square me-1"></i>' + msg.MESSAGE,
        timeout: globaltimer,
        animation: {
            open: 'animated bounceInRight', // Animate.css class names
            close: 'animated bounceOutRight' // Animate.css class names
        },
        callbacks: {
            afterShow: function () {  }
        }
    }).show();
}
1

There are 1 best solutions below

0
Alex T On

In general, the visibilityControl option is responsible for disabling this behavior. But why is it not working.