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
Description:
I'm trying to use onesignal web push notifications. from dotnet api, i send the notification successfully. in front-side, i get the notification and it gets displayed inside asp.net web pages. All is good, but what I need now is when I get the notification on the front-side, i have to do consume the entire event data and do further processing and UI refresh etc.
Which leads me to the situation where I need to know when notification gets received on front-side. It failed with TypeError: OneSignal.on is not a function with bellow code
<script src="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js" defer></script>
<script>
window.OneSignalDeferred = window.OneSignalDeferred || [];
OneSignalDeferred.push(async function (OneSignal) {
await OneSignal.init({
appId: "04680373-b77a-40be-b9df-477de5b5f902", notifyButton: {
enable: true
},
serviceWorkerParam: { scope: "/js/" },
serviceWorkerPath: "/js/OneSignalSDKWorker.js",
});
});
OneSignalDeferred.push(async function (OneSignal) {
OneSignal.on('notificationDisplay', function (event) {
console.log('OneSignal notification displayed:', event);
});
});
OneSignalDeferred.push(async function (OneSignal) {
OneSignal.on('notificationDismiss', function (event) {
console.log('OneSignal notification dismissed:', event);
});
});
</script>
I have already gone thru those pages. any guidance or help is appreciated.
Description:
I'm trying to use onesignal web push notifications. from dotnet api, i send the notification successfully. in front-side, i get the notification and it gets displayed inside asp.net web pages. All is good, but what I need now is when I get the notification on the front-side, i have to do consume the entire event data and do further processing and UI refresh etc.
Which leads me to the situation where I need to know when notification gets received on front-side. It failed with TypeError: OneSignal.on is not a function with bellow code
<script src="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js" defer></script>
<script>
window.OneSignalDeferred = window.OneSignalDeferred || [];
OneSignalDeferred.push(async function (OneSignal) {
await OneSignal.init({
appId: "04680373-b77a-40be-b9df-477de5b5f902", notifyButton: {
enable: true
},
serviceWorkerParam: { scope: "/js/" },
serviceWorkerPath: "/js/OneSignalSDKWorker.js",
});
I have already gone thru those pages. any guidance or help is appreciated.
The text was updated successfully, but these errors were encountered: