The entry point to WonderPush.
Methods
-
<static> init(options)
-
Initialize the SDK.
Parameters:
Name Type Description options
Object Initialization options.
Properties
Name Type Argument Default Description webKey
string The Web key of your application.
userId
string <optional>
<nullable>
null The unique id of the user browsing the page.
applicationName
string <nullable>
The name of your website. This will be displayed during the registration process. It defaults to your website hostname.
applicationVersion
string The version of the browsed website.
geolocation
boolean <optional>
<nullable>
false Whether to use the Geolocation API. This setting applies on startup and will prompt the user for permission the first time. You can use the WonderPushSDK.Geo.useGeolocation function at the most appropriate time. if desired. WonderPush remembers if the permission has been previously granted and, if so, enables it automatically.
notificationIcon
string <optional>
<nullable>
The absolute, preferably HTTPS, URL to the notification icon. It is displayed in the registration process and along displayed notifications.
notificationDefaultUrl
string <optional>
The absolute URL to your website front page. This is the URL that will be opened if no page is already opened and no custom URL is present in the notification.
customDomain
string <optional>
This option is overridden by the configuration the SDK dynamically fetches. The unique domain that controls the whole notification process. The Notification permission is bond to this domain, changing this value will require users to subscribe again, although previous registrations will still continue to work for some unspecified time. This is the domain that will be displayed in the Notification permission popup and at the bottom of each notification. You can use either a simple string with no dots:
mybrand
, ormybrand.by.wonderpush.com
. If your current plan permits it, you can customise it:www.mybrand.com
. Using this second variant, you would need to host a few more files and enable HTTPS on your website. Contact us for more information. -
<static> ready(callback)
-
Get the WonderPush SDK instance, when it is ready.
Parameters:
Name Type Description callback
WonderPush.ReadyCallback This function will be called with the WonderPushSDK instance as first argument, after the SDK has successfully initialized.
Type Definitions
-
ReadyCallback(sdk)
-
Parameters:
Name Type Description sdk
WonderPushSDK The initialized SDK instance.