Alternative to runtime.onSuspend?

James Anderson proginosko at gmail.com
Thu Sep 28 16:10:23 UTC 2017


Thanks, that's helpful. Basically I need to make sure some variables are
saved to local storage. That's going to require calling an asynchronous
function, but I guess it's not crucial for me to confirm that the operation
was successful.

James


On Thu, Sep 28, 2017 at 11:16 AM, Andrew Swan <aswan at mozilla.com> wrote:

>
>
> On Wed, Sep 27, 2017 at 5:52 PM, James Anderson <proginosko at gmail.com>
> wrote:
>
>> Thanks for the reply, Andrew. I (wrongly) assumed that onSuspend was the
>> counterpart to onStartup. Also, the documentation on onSuspend says, "This
>> gives the extension an opportunity to do some cleanup."
>>
>> My extension definitely needs to do some cleanup before a Firefox
>> shutdown, but perhaps also before an uninstall.
>>
>
> You can use an event listener on the "unload" event in your background
> page.  But understand that you can't do anything asynchronous from here --
> the extension is about to be torn down and you can't postpone that.
> Perhaps if you explain what specifically needs to be cleaned up we can
> offer other suggestions.
>
> -Andrew
>
>


-- 
James Anderson
Email: proginosko at gmail.com
Website: www.proginosko.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/webextensions-support/attachments/20170928/9dbd2b35/attachment-0001.html>


More information about the Webextensions-support mailing list