You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: use markdown code fences in service worker docs
Replaces the <docs-code> component with standard markdown code fences in the service worker documentation. This improves the readability and maintainability of the documentation.
(cherry picked from commit d42f9ce)
Copy file name to clipboardExpand all lines: adev/src/content/ecosystem/service-workers/push-notifications.md
+31-36Lines changed: 31 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,20 +23,18 @@ The default behavior for the `notificationclick` event is to close the notificat
23
23
You can specify an additional operation to be executed on `notificationclick` by adding an `onActionClick` property to the `data` object, and providing a `default` entry.
24
24
This is especially useful for when there are no open clients when a notification is clicked.
@@ -60,31 +58,29 @@ Each action is represented as an action button that the user can click to intera
60
58
61
59
In addition, using the `onActionClick` property on the `data` object, you can tie each action to an operation to be performed when the corresponding action button is clicked:
62
60
63
-
<docs-codelanguage="typescript">
64
-
61
+
```json
65
62
{
66
-
"notification": {
67
-
"title": "New Notification!",
68
-
"actions": [
69
-
{"action": "foo", "title": "Open new tab"},
70
-
{"action": "bar", "title": "Focus last"},
71
-
{"action": "baz", "title": "Navigate last"},
72
-
{"action": "qux", "title": "Send request in the background"},
IMPORTANT: If an action does not have a corresponding `onActionClick` entry, then the notification is closed and `SwPush.notificationClicks` is notified on existing clients.
90
86
@@ -93,7 +89,6 @@ IMPORTANT: If an action does not have a corresponding `onActionClick` entry, the
93
89
You might also be interested in the following:
94
90
95
91
<docs-pill-row>
96
-
97
92
<docs-pillhref="ecosystem/service-workers/communications"title="Communicating with the Service Worker"/>
0 commit comments