Home Reference Source
import PushNotification from '~/models/PushNotifications.js'
public class | source

PushNotification

Manages push notifications across different platforms.

Constructor Summary

Public Constructor
public

constructor(options: Object)

Creates PN but you probably want to use PushNotification.shared

Member Summary

Public Members
public get

The APN URL.

public get

If APN is setup

public get

If Push is setup.

public get

If we have been denied perms

public get

Gets if the user has expressibly forbidden

public set

Sets if the user has expressibly forbidden

public get

If has permission to send notifs

public get

If should ask for permission

public get

If we should show a request

public get

Checks if PNs are supported

public get

If to use APN flow

public get

If to use Push flow

public

Apple Web Push Notification ID

Method Summary

Public Methods
public

Requests permission for desktop push notifications.

Public Constructors

public constructor(options: Object) source

Creates PN but you probably want to use PushNotification.shared

Params:

NameTypeAttributeDescription
options Object
  • optional
  • default: {}
options.webAPNId string
  • nullable: true

The web APN ID or null if not supported.

Public Members

public get apnURL: string source

The APN URL. null if we don't support

public get backendSupportsAPN: boolean source

If APN is setup

public get backendSupportsPush: boolean source

If Push is setup. We will always assume true

public get denied: boolean source

If we have been denied perms

public get forbiddenRequest: boolean source

Gets if the user has expressibly forbidden

public set forbiddenRequest: boolean source

Sets if the user has expressibly forbidden

public get hasPermissions: boolean source

If has permission to send notifs

public get needsRequest: boolean source

If should ask for permission

public get shouldShowRequest source

If we should show a request

public get supportsPNs: boolean source

Checks if PNs are supported

public get useAPN: boolean source

If to use APN flow

public get usePush: string source

If to use Push flow

public webAPNId: string source

Apple Web Push Notification ID

Public Methods

public requestPriviledge(): boolean source

Requests permission for desktop push notifications. If there is already perms this will request again.

Return:

boolean

If priviledge was obtained or not