JavaScript Client
SDK Client
Constructor
projectId
string
required
vapidPublicKey
string
required
isHTTPS
boolean
required
endpoint
string
required, value: https://api.pushpushgo.com
websitePushId
string
required only for Safari integration
swPath
string
optional, path to sw.js
file when other than root
Methods
isPushSupport(): Promise<void>
isPushSupport(): Promise<void>
Check if the browser supports web push notifications
isSubscribed(): Promise<boolean>
isSubscribed(): Promise<boolean>
Check if subscriber is registered
register(options?: ISubscribeOptions): Promise<string>
register(options?: ISubscribeOptions): Promise<string>
Register new subscriber - show popup dialog or native permission window
returns
subscriberId
fields
{ customId?: string}
optional
tags
string[]
optional
unsubscribe(): Promise<void>
unsubscribe(): Promise<void>
Unsubscribe existing subscriber at database
checkPermission(): Promise<boolean>
checkPermission(): Promise<boolean>
Check for native permission
appendTags(tags: string[]): Promise<string[]>
appendTags(tags: string[]): Promise<string[]>
Append tags to store. For tag with labels support use labelName:tagName
syntax.
tags
string[]
setCustomId(customId: string | number): Promise<void>
setCustomId(customId: string | number): Promise<void>
Sets customId in cloned store
removeTags(tags: string[]): Promise<string[]>
removeTags(tags: string[]): Promise<string[]>
Remove tag(s) by label from store For labels support please use 'labelName:tagName'
syntax
setSelector(selectorName: string, value: string | number | null | boolean): Promise<void>
setSelector(selectorName: string, value: string | number | null | boolean): Promise<void>
Set selector value - field must be declared in application first
send(immediately?: boolean): Promise<boolean>
send(immediately?: boolean): Promise<boolean>
Set beacon to send on event before unload
getCustomId(): Promise<string>
getCustomId(): Promise<string>
returns
subscriber's customId
getId(): Promise<string>
getId(): Promise<string>
returns
subscriberId
getTags(): Promise<string[]>
getTags(): Promise<string[]>
returns
current subscriber's tags
getTagsToRemove(): Promise<string[]>
getTagsToRemove(): Promise<string[]>
returns
subscriber's tags to remove
clearState(): void
clearState(): void
Clear state, reset values
Last updated