I am trying to learn async/await. I want to wait for the return statement inside my async function. I have to call it several times so I used a setTiemout inside.
EDIT:
//Processing gallery
async function somefunction(){
    async function getPictureR(){
        /* some code */
        if($('.actions > .prev', html)[0]){
            older = $('.actions > .prev', html)[0].attribs.href;
        } else {
            console.log('return');
            return;
        }
        /* some code */
        return new Promise((resolve, reject) => {
            setTimeout(getPictureR, 1 * 1000/2);    
        })
    }
    await getPictureR();
    console.log('getPictureR done');
}
I've tried await getPictureR() but it triggers right after the first call to the function. How can I wait for that return ?
 
    