Back to Content

WorkerNavigator: clearAppBadge() method

files/en-us/web/api/workernavigator/clearappbadge/index.md

latest1.2 KB
Original Source

{{APIRef("Badging API")}}{{securecontext_header}}

The clearAppBadge() method of the {{domxref("WorkerNavigator")}} interface clears a badge on the current app's icon by setting it to nothing. The value nothing indicates that no badge is currently set, and the status of the badge is cleared.

Syntax

js-nolint
clearAppBadge()

Parameters

None.

Return value

A {{jsxref("Promise")}} that resolves with {{jsxref("undefined")}}.

Exceptions

  • InvalidStateError {{domxref("DOMException")}}
    • : Thrown if the document is not fully active.
  • SecurityError {{domxref("DOMException")}}
  • NotAllowedError {{domxref("DOMException")}}
    • : Thrown if {{domxref('PermissionStatus.state')}} is not granted.

Examples

Once all messages in an application have been read, call clearAppBadge() to clear the badge and remove the notification.

js
navigator.clearAppBadge();

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also