I want to call a function from within the eventListener

```
I get this error : 
TypeError: this.foo is not a function

```

I understand that **this** is the `xhr` itself and not the class that wraps both function.

How can I call `foo` from within the `eventListener` callback? 

```
createStripeUser = async (code) => {

    const xhr = new XMLHttpRequest();
    xhr.withCredentials = true;

    xhr.addEventListener("readystatechange", function () {
        if (this.readyState === 4) {
             this.foo(this.responseText)
        }
    });

    xhr.open("POST", "https://connect.stripe.com/oauth/token");
    xhr.send(data);
}
foo  = (data ) => {
    console.log(data)
}

```