function test() {
return new Promise(async function(success) {
var result = await camel();
if (result !== false) {
success(result);
}
else {
setTimeout(async function() {
var result = await test();
success(result);
}, 1000);
}
});
}
async function test() {
let result = null;
do {
result = await camel() || await new Promise(r => setTimeout(r, 1000));
} while (!result);
return result;
}