javascriptlimitnotifyflooding

how to limit notification(notify)


I want to show just a one-time error message. But not other classnames ex (classname success message show itself every time but error message just one time shows). When I triggered error message last error message must close and open new error message.

$.notify(Util.Localize.Resource(
    "bb53c064-e1d6-429d-b49f-bd1ec5fc83b6",
    "{
        en: 'Please Fill the Branch Name Field',
        tr: 'Lütfen şube alanını giriniz.',
        ar: 'يرجى ملء حقل اسم الفرع'
    }"
),
{
    position: 'top-right',
    showAnimation: 'slideDown',
    hideAnimation: 'slideUp',
    className: 'error'
});

Solution

  • I add notify to util.js and get class name from view.

    if (notificationType === Enum.NotificationType.Warning) {
        if (document.getElementsByClassName("notifyjs-wrapper notifyjs-hidable").length !== 0) 
            return;
    
        else {
            $.notify(message, {
                position: 'top-right',
                showAnimation: 'slideDown',
                hideAnimation: 'slideUp',
                className: 'error'
            });
        }
    }