summaryrefslogtreecommitdiffstats
path: root/examples/webenginewidgets/push-notifications/content/worker.js
diff options
context:
space:
mode:
Diffstat (limited to 'examples/webenginewidgets/push-notifications/content/worker.js')
-rw-r--r--examples/webenginewidgets/push-notifications/content/worker.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/webenginewidgets/push-notifications/content/worker.js b/examples/webenginewidgets/push-notifications/content/worker.js
new file mode 100644
index 000000000..ed660a6e9
--- /dev/null
+++ b/examples/webenginewidgets/push-notifications/content/worker.js
@@ -0,0 +1,7 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+self.addEventListener('push', event => {
+ const data = event.data.json();
+ self.registration.showNotification(data.title, { body : data.text });
+});