JavaScript Client

SDK Client

Constructor

new Client(config_params)
parameter
type
description

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>

Check if the browser supports web push notifications

isSubscribed(): Promise<boolean>

Check if subscriber is registered

register(options?: ISubscribeOptions): Promise<string>

Register new subscriber - show popup dialog or native permission window

returns subscriberId

parameter
type
description

fields

{ customId?: string}

optional

tags

string[]

optional

unsubscribe(): Promise<void>

Unsubscribe existing subscriber at database

checkPermission(): Promise<boolean>

Check for native permission

appendTags(tags: string[]): Promise<string[]>

Append tags to store. For tag with labels support use labelName:tagName syntax.

parameter
type
description

tags

string[]

setCustomId(customId: string | number): Promise<void>

Sets customId in cloned store

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>

Set selector value - field must be declared in application first

send(immediately?: boolean): Promise<boolean>

Set beacon to send on event before unload

getCustomId(): Promise<string>

returns subscriber's customId

getId(): Promise<string>

returns subscriberId

getTags(): Promise<string[]>

returns current subscriber's tags

getTagsToRemove(): Promise<string[]>

returns subscriber's tags to remove

clearState(): void

Clear state, reset values

Last updated