postalsys / imapflow

IMAP Client library for EmailEngine Email API (https://emailengine.app)
https://imapflow.com
Other
364 stars 63 forks source link

Please clarify docs #183

Closed ile closed 7 months ago

ile commented 7 months ago

This seems unclear:

If idle() is called manually then it does not return until IDLE is finished which means you would have to call some other command out of scope.

What does this mean: "you would have to call some other command out of scope"? When does the idle() return exactly?

Maybe clarify the docs?

Thanks.

andris9 commented 7 months ago

It's an async issue.

await connection.idle()
// this line is never reached because the idle never completes

vs

setTimeout(()=>{
  connection.noop();
}, 10*1000);
await connection.idle()
// this line is reached after 10 seconds because executing another IMAP operation will terminate the pending IDLE

ImapFlow only exists for EmailEngine, so I haven't paid too much attention to docs or examples.

ile commented 7 months ago

Ok, thanks! "Out of scope" was a bit confusing - it seems it's just when another IMAP operation is called during IDLE.