Skip to content

Commit

Permalink
Fix JS syntax issues in NotificationManager.web.kt to make it work wo…
Browse files Browse the repository at this point in the history
…rk K/JS
  • Loading branch information
bashor committed May 17, 2024
1 parent 93a04b0 commit 3bcbedf
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ private external object Notification {
private fun registerNotificationByServiceWorker(delay: Long, title: String, message: String): Unit =
js(
"""{
if (typeof navigator === "undefined" || !navigator.serviceWorker?.ready) return;
navigator.serviceWorker.ready.then((registration) => {
if (typeof navigator === "undefined" || navigator.serviceWorker == null || !navigator.serviceWorker.ready) return;
navigator.serviceWorker.ready.then(function (registration) {
registration.active.postMessage({
command: 'register-notification',
title: title,
Expand All @@ -22,8 +22,8 @@ private fun registerNotificationByServiceWorker(delay: Long, title: String, mess
private fun cancelNotificationByServiceWorker(title: String): Unit =
js(
"""{
if (typeof navigator === "undefined" || !navigator.serviceWorker?.ready) return;
navigator.serviceWorker.ready.then((registration) => {
if (typeof navigator === "undefined" || navigator.serviceWorker == null || !navigator.serviceWorker.ready) return;
navigator.serviceWorker.ready.then(function (registration) {
registration.active.postMessage({
command: 'cancel-notification',
title: title,
Expand Down

0 comments on commit 3bcbedf

Please sign in to comment.