Cannot add Event Handler functions

Since implementing Git Integration I have become unable to add Event Handlers to the website elements.
What could be a possible cause for that?

Hi there!

You can add event handlers by directly referencing the element in your synced local editor.

Example:

$w("#getCaption").onClick(() => {
        //Handle the click here
});

As the Git integration is still in beta we would love your feedback around event handlers.

The best place to discuss this feature is within the #github section of our Discord channel.

You can join here: Invite

Yes that is exactly what I have done. However, since by declaring this way the function does not have a named reference like



export async function getCaption_click(_event) {
	...
}

If I want to call the same function from inside some other function, to avoid duplicating the code for getCaption_click function, how do I do that?

Furthermore how do I use async in this case?

$w.onReady(()=> {   
    $w('#getCaption').onClick(async(event) => {
       let resultData = await start_myFunction();
    });
});

!!! Good luck and happy coding !!!

!!! May the CODING POWER be with you !!!

Thank you! That is immensely helpful.