I'm having trouble figuring out how to capture when a user cancels a background export task (from the background tasks panel). ImportExportTask.FAILED_EXPORT doesn't appear to work as described by the documentation, regardless if I listen on the app or the document being exported.
I've also tried using Idletasks which wait for changes in status to the BackgroundTask, but it seems really dirty, and IdleEvent.ON_IDLE events don't trigger reliably enough for my purposes (based on my own experience).
Ideally I'd like to capture the completion of asynchronous export events (success, failure, or cancellation) as soon as they happen, so that I can close the associated documents (which my script has generated and remain open in the background during the export process) and let the user get on with their day. Success events are no problem, it's the others I'm having trouble with.
I'd really appreciate it if anyone could help me with this, I've been spinning my wheels on this one for far too long.