Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/runtime/onsuspendcanceled/index.md
6565 views
---
title: runtime.onSuspendCanceled slug: Mozilla/Add-ons/WebExtensions/API/runtime/onSuspendCanceled page-type: webextension-api-event tags: - API - Add-ons - Event - Extensions - Non-standard - Reference - WebExtensions - onSuspendCanceled - runtime browser-compat: webextensions.api.runtime.onSuspendCanceled
---

{{AddonSidebar()}}

Sent after {{WebExtAPIRef("runtime.onSuspend")}} to indicate that the app won't be unloaded after all.

Syntax

browser.runtime.onSuspendCanceled.addListener(listener) browser.runtime.onSuspendCanceled.removeListener(listener) browser.runtime.onSuspendCanceled.hasListener(listener)

Events have three functions:

  • addListener(callback)

    • : Adds a listener to this event.

  • removeListener(listener)

    • : Stop listening to this event. The listener argument is the listener to remove.

  • hasListener(listener)

    • : Checks whether a listener is registered for this event. Returns true if it is listening, false otherwise.

addListener syntax

Parameters

  • callback

    • : Function that will be called when this event occurs.

Browser compatibility

{{Compat}}

Examples

Listen for SuspendCanceled events:

function handleSuspendCanceled() { console.log("Suspend canceled"); } browser.runtime.onSuspendCanceled.addListener(handleSuspendCanceled);

{{WebExtExamples}}

Note: This API is based on Chromium's chrome.runtime API. This documentation is derived from runtime.json in the Chromium code.