mercredi 24 août 2016

Why is func undefined in this context?

So I have a function like

func()
{
    const curVal = this.curVal;
    const callAgain = () => { func(); };
    Axios.get('somecontroller/someaction')
        .then(response =>
        {
            const newVal = response.data.curVal;
            if(curVal === newVal)
                setTimeout(callAgain, 500);
            else
                // ....
        })
        .catch(response =>
        {
            // ...
        });
}

and my browser is complaining about the line

const callAgain = () => { func(); };

saying that func is undefined. Any idea why? How can I fix?

Aucun commentaire:

Enregistrer un commentaire