Can I Deactivate function?

I read the article in this forum. But I don’t really understand.
I want the function below to be deactivated forever when I click some button.
What should I do? Please save me…
Big love bro

import wixWindow from ‘wix-window’ ;
const pageSections = ;
$w . onReady ( function () {
if ( wixWindow . formFactor === “Desktop” ) {
getPageSections ();
initSectionScrollSnap ();
}
});

function getPageSections ( ) {
$w ( ‘Page’ ). children . forEach ( section => {
section . type === ‘$w.Section’ && pageSections . push ( section );
});
}

function initSectionScrollSnap ( ) {
const bgShapes = [
‘section1Background’ ,
‘section2Background’ ,
‘section3Background’ ,
‘section4Background’ ,
‘section5Background’ ,
‘section6Background’ ,
‘section7Background’ ,
‘section8Background’
];
bgShapes . forEach (( container , index ) => {
const bgShape = $w ( # ${ bgShapes [ index ]});
bgShape . onViewportEnter ( async () => {
await pageSections [ index ]. scrollTo ();
});
})
}

import wixWindow from 'wix-window';
const pageSections = [];


$w.onReady(function() {let passed = false;
    if (wixWindow.formFactor === "Desktop") {
        if(!passed) {console.log('Access granted! First time running function!');
            initSectionScrollSnap();
        }
        else {console.log('Access denied! This function already was fired once!')}        
    }
});


function initSectionScrollSnap() {passed = true;
    //your function here...
}