Cannot read property 'apply' of undefined - caused by clientside_callback

Hey guys,

I’m building a web app that on the Mobile and Desktop some components will have different behaviors;

I have implemented a JS piece code to get the screen size + the position of the user on the app, but after I added the code to my web app, it started to show an error:


I think that everything is working well on my application, but I would like to understand and if possible, remove this error, but I can’t understand what’s wrong when reading the error output;

The JS snippet is below:

app.clientside_callback(
“”"
window.addEventListener(‘scroll’, function() {
var element_takeaway = document.querySelector(’#takeaway-hid-card’);
var position = window.scrollY;
var h = document.body.scrollHeight;
var height = window.offsetHeight;
var margin_page = 1160

    if (position > h-margin_page) {
         element_takeaway.style.display='none';
    } else {
         element_takeaway.style.display='block';
    };
});
""",
Output('viewport-scrollY', 'children'),
Input('url', 'href')

)

Could someone give me some light on this?

Thank you in advance!!!
Regards,
Leonardo