Closed CodeWithOz closed 4 years ago
Hey @CodeWithOz,
Multiple calls should not really affect anything - these calls will use the same singletons and set values for the same parameters, however, you can safely remove all the calls of the method except for just one - you just have to make sure it is called prior to calling any other Pushwoosh plugin method or triggering any notification-based callback on the very first run.
@wfhm thanks! One more thing. The repeated code is actually structured like this:
var pushNotification = cordova.require("pushwoosh-cordova-plugin.PushNotification");
pushNotification.onDeviceReady({
projectid: "12345678901",
appid: "SOME-VALUE"
});
So it's the same singleton that gets returned every time cordova.require("pushwoosh-cordova-plugin.PushNotification")
is called, correct?
@CodeWithOz,
Yes, it should be fine. You can also refer to the sample below for examples of using particular methods of the Pushwoosh plugin, including onDeviceReady:
https://github.com/Pushwoosh/pushwoosh-phonegap-cordova-sample/blob/master/Cordova/www/js/index.js
Hi, I'd like to know if there are any harmful effects to calling
pushwoosh.onDeviceReady()
multiple times within the app. This was already done in my code base by someone else, but I'm not able to verify why it was done. So I'd like to know if there may be some reason behind it that I'm not aware of, or if there are harmful side-effects that were not taken into account when this was done. Thanks.