I am looking for information about using own javascript and make call back a function in the studio code.

For example: I want to use a opensource javascript library for a calendar.
- When someone wants to edit an event, i want to call a function within the studio code to edit this event
Or
- If the user what to 'Drag-and-drop' an event to another day, i have to call a function in the studio code to move this event

Has someone figured out how to do this? Maybe with an example?