JS Error subscriptionChange()
-
Hello,
I am using your plugin and i try to catch the subscriptionChange event but i got an error.
How can i perform this ?
my code :
window.OneSignal.push(function() {
window.OneSignal.init(window._oneSignalInitOptions);
let searchParams = new URLSearchParams(window.location.search)
if (searchParams.has("login"))
{
if (searchParams.get("login") == "true")
{
saveOneSignalDataToUser();
}
}
else
{
saveOneSignalDataToUser();
}
OneSignal.on("subscriptionChange", function(isSubscribed) {
//console.log("The user's subscription state is now:", isSubscribed);
if (isSubscribed)
{
saveOneSignalDataToUser();
}
});
});This line throw me an error : OneSignal.on(“subscriptionChange”, function(isSubscribed)
TypeError: OneSignal.on is not a function. (In ‘OneSignal.on(“subscriptionChange”, function (isSubscribed) {
Thanks for your help !
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.