Async operation in deactivate callback


#1

I want to perform some action when my package is deactivated (by closing atom or disabling my package).
I perform this action in the deactivate function in my package’s main file

The problems is that the action i want to perform is asynchronous thus, if the user closes atom
my deactivate function is called, it returns and atom closes. All this before my asynchronous action is complete.
How would i go about ensuring that my asynchronous action completes before atom closes? I’ve tried wrapping it
all in a promise and using the await keyword. But it doesn’t seam to be supported (or i’m using await in the wrong way which is equally likely)


#2

Hmm, the deactivate method is async now so your use case should be supported. What version of Atom are you testing this on?