Elias
Elias

Reputation: 1

no-unused-vars in Vuejs

Module build failed because of the following eslint errors: the below code is giving me an error which i am not able to track

TM_onLoadPopupPromoBox: function() {
            var $modal = $('.on-pageload-popup-promobox');
            if( $modal.length > 0 ) {
                $modal.each( function(){
                    var $current_item       = $(this);
                    var target              = $current_item.data('target');
                    var timeout             = $current_item.data('timeout');

                    var delay               = $current_item.data('delay');
                    delay = ( !delay ) ? 2500 : Number(delay) + 2500;

                    if( $current_item.hasClass('cookie-enabled') ) {
                        var elementCookie = $.cookie( target );
                        if ( !!elementCookie && elementCookie === 'enabled' ){
                            return true;
                        }
                    } else {
                        $.removeCookie( target );
                    }

                    var t_enablepopup = setTimeout(function() {
                        $.magnificPopup.open({
                            items: { src: target },
                            type: 'inline',
                            mainClass: 'mfp-no-margins mfp-fade',
                            closeBtnInside: false,
                            fixedContentPos: true,
                            removalDelay: 500,
                            callbacks: {
                                afterClose: function() {
                                    if( $current_item.hasClass('cookie-enabled') ) {
                                        $.cookie( target, 'enabled' );
                                    }
                                }
                            }
                        }, 0);
                    }, Number(delay) );

                    if( timeout !== '' ) {
                        var t_closepopup = setTimeout(function() {
                            $.magnificPopup.close();
                        }, Number(delay) + Number(timeout) );
                    }
                });
            }
        },

The errors: I am having so many errors 't_enablepopup' is assigned a value but never used

could anyone help me?

Upvotes: 0

Views: 82

Answers (2)

Lioness100
Lioness100

Reputation: 8402

When declaring this function:

onSelected: function(selectedData)

You are passing the parameter selectedData. However, this parameter is never used in the following function, so an error appeared. You can just remove that parameter from the function to get rid of any errors.

onSelected: function()

Upvotes: 0

Germano Buss Niehues
Germano Buss Niehues

Reputation: 234

you're declaring one parameter you're not using, remove the selectedData:

onSelected: function(){
                        $("#"+id+ " .dd-selected-value").prop ('name', name);      
                      },

Upvotes: 1

Related Questions