Create custom javascript functions in the browser OnInitialize?
Question

I'm using LeafletJS as a dependency and I need to add some drag handlers. I can successfully do this by adding them to the header of the script in the Interface script dependency & it all works fine. I can address it in DevTools console. Like this:

However, I'd like to add some inputs/variables to those handlers so I thought I could move them to OnInitialize of the block, then just call the same JS form there, however it is saying the function isn't available and I can't see it in DevTools console. Likethis:


What am I missing?

Hi @Steve Webb , I think there is no function for that but I supposed it's a method attached like for example to a Marker.

Kind regards,

So any idea how I could achieve it? I think I need to load the drag handlers in the actual module itself, as they are required for the on initialise of the main app I am using it in.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.