Request handler in Javascript

I am new to JS.
how can I handle fetch/XHR events in javascript? Basically I need to check if any fetch call has happened.
For example, in case of ajax call I could do this :

jQuery(document).ajaxSuccess(() => {
//some function
}