- API_REGISTER
- API_REGISTER_SAFARI
- API_SAFARI_APPLICATION_ID
- API_SAFARI_ENDPOINT
- API_UNREGISTER
- API_UNREGISTER_SAFARI
- API_URL
- API_WEB_PUSH_ID
- APP_ID_PREFIX
- APP_INSTALL_DATE
- APP_NAME_PREFIX
- APP_VERSION_PREFIX
- DEFAULT_SW_PATH
- FCM_TOKEN_PREFIX
- NOTIFICATIONS_ACCEPTED_EVENT
- NOTIFICATIONS_DECLINED_EVENT
- PREFIX
- PushInstaller
- SHOW_NOTIFICATION
- SW_MESSAGE
- SW_PATH
- USER_ID_PREFIX
- info
- publicVapidKey
- warn
- checkSafariNotificationPermission
- checkServices
- checkStandardNotificationPermission
- registerExternalScript
Ƭ DefaultValue: Primitive | Function | Record‹string, string›
Defined in src/utils/getLocalStorageParam.ts:3
Ƭ RegisterConfig: object
Defined in src/api/getConfig.ts:6
-
appId: string | null
-
appName: AppName
-
appVersion: string | null
-
createAt: string | null
-
deviceToken: string | null
-
deviceType: DeviceType
-
timezone: number
-
updateAt: string | null
-
userId: string | null
Ƭ SWRegistration: PushSubscription | Response | null | undefined | void
Defined in src/WebPush.ts:18
Ƭ UnregisterConfig: object
Defined in src/api/getConfig.ts:18
-
appId: string | null
-
appName: AppName
-
deviceType: DeviceType
• API_REGISTER: "register" = "register"
Defined in src/constants/api.ts:19
• API_REGISTER_SAFARI: "register-safari" = "register-safari"
Defined in src/constants/api.ts:20
• API_SAFARI_APPLICATION_ID: "web-safari-push" = "web-safari-push"
Defined in src/constants/api.ts:25
• API_SAFARI_ENDPOINT: "safari" = "safari"
Defined in src/constants/api.ts:24
• API_UNREGISTER: "unregister" = "unregister"
Defined in src/constants/api.ts:21
• API_UNREGISTER_SAFARI: "unregister-safari" = "unregister-safari"
Defined in src/constants/api.ts:22
• API_URL: "https://push.mirtesen.ru/api/push" = "https://push.mirtesen.ru/api/push"
Defined in src/constants/api.ts:1
• API_WEB_PUSH_ID: "web.com.push" = "web.com.push"
Defined in src/constants/api.ts:27
• APP_ID_PREFIX: string = ${PREFIX}_push_id
Defined in src/constants/api.ts:6
• APP_INSTALL_DATE: string = ${PREFIX}_push_install_date
Defined in src/constants/api.ts:8
• APP_NAME_PREFIX: string = ${PREFIX}_push_name
Defined in src/constants/api.ts:7
• APP_VERSION_PREFIX: string = ${PREFIX}_push_version
Defined in src/constants/api.ts:5
• DEFAULT_SW_PATH: "service-worker.js" = "service-worker.js"
Defined in src/constants/api.ts:17
• FCM_TOKEN_PREFIX: string = ${PREFIX}_fcm_token
Defined in src/constants/api.ts:10
• NOTIFICATIONS_ACCEPTED_EVENT: string = ${PREFIX}_notifications_accepted
Defined in src/constants/api.ts:14
• NOTIFICATIONS_DECLINED_EVENT: string = ${PREFIX}_notifications_declined
Defined in src/constants/api.ts:15
• PREFIX: "web_push_lib" = "web_push_lib"
Defined in src/constants/api.ts:2
• PushInstaller: WebPush‹› = new WebPush()
Defined in src/web-push-installer.ts:3
• SHOW_NOTIFICATION: string = ${PREFIX}_show_notification
Defined in src/constants/signals.ts:3
• SW_MESSAGE: string = ${PREFIX}_sw_message
Defined in src/constants/signals.ts:4
• SW_PATH: string = ${PREFIX}_sw_path
Defined in src/constants/api.ts:3
• USER_ID_PREFIX: string = ${PREFIX}_user_id
Defined in src/constants/api.ts:12
• info: info
Defined in src/WebPush.ts:20
• publicVapidKey: "VAPID_KEY_FROM_CONSOLE" = "VAPID_KEY_FROM_CONSOLE"
Defined in src/constants/firebase.ts:1
• warn: warn
Defined in src/api/registerOnPushServer.ts:4
Defined in src/firebase/initFCM.ts:5
Defined in src/api/unregisterOnPushServer.ts:4
Defined in src/WebPush.ts:20
Defined in src/service-worker.ts:10
▸ getFCMToken(messaging
: FirebaseMessaging): Promise‹object›
Defined in src/firebase/getFCMToken.ts:10
Generate or return existing Firebase Cloud Messaging device token
Parameters:
Name | Type |
---|---|
messaging |
FirebaseMessaging |
Returns: Promise‹object›
▸ initFCM(registration
: ServiceWorkerRegistration): FirebaseMessaging
Defined in src/firebase/initFCM.ts:13
Initialize Firebase Cloud Messaging service Subscribe on device token refresh event
Parameters:
Name | Type |
---|---|
registration |
ServiceWorkerRegistration |
Returns: FirebaseMessaging
▸ checkSafariNotificationPermission(): Promise‹SafariPermission›
Defined in src/utils/checkPermission.ts:5
Returns: Promise‹SafariPermission›
▸ checkServices(): CheckServices
Defined in src/utils/checkServices.ts:11
Returns: CheckServices
▸ checkStandardNotificationPermission(): Promise‹boolean›
Defined in src/utils/checkPermission.ts:22
Returns: Promise‹boolean›
▸ registerExternalScript(url
: string, onLoad?
: undefined | function): void
Defined in src/utils/registerExternalScript.ts:1
Parameters:
Name | Type |
---|---|
url |
string |
onLoad? |
undefined | function |
Returns: void
▸ getConfig(type
: "register" | "unregister"): object
Defined in src/api/getConfig.ts:82
Create configuration based on push server request type
Parameters:
Name | Type | Default |
---|---|---|
type |
"register" | "unregister" | "register" |
Returns: object
-
appId: string | null
-
appName: AppName
-
deviceType: DeviceType
▸ getRegisterConfig(): RegisterConfig
Defined in src/api/getConfig.ts:28
Create registration configuration based on push server request scheme
Returns: RegisterConfig
▸ getUnregisterConfig(): UnregisterConfig
Defined in src/api/getConfig.ts:62
Create unregister configuration based on push server request scheme
Returns: UnregisterConfig
▸ registerOnPushServer(isSafari?
: undefined | false | true): Promise‹Response | void›
Defined in src/api/registerOnPushServer.ts:11
Register on push server with provided configuration from getRegisterConfig output
Parameters:
Name | Type |
---|---|
isSafari? |
undefined | false | true |
Returns: Promise‹Response | void›
▸ unregisterOnPushServer(isSafari?
: undefined | false | true): Promise‹Response | void›
Defined in src/api/unregisterOnPushServer.ts:11
Unegister on push server with provided configuration from getUnregisterConfig output
Parameters:
Name | Type |
---|---|
isSafari? |
undefined | false | true |
Returns: Promise‹Response | void›
▸ handleClientBroadcast(event
: MessageEvent & ExtendableEvent): void
Defined in src/service-worker.ts:17
Handle message event with defined type from signals from main thread
Parameters:
Name | Type |
---|---|
event |
MessageEvent & ExtendableEvent |
Returns: void
▸ handlePush(event
: PushEvent): void
Defined in src/service-worker.ts:41
Handle push message event (show notification)
Parameters:
Name | Type |
---|---|
event |
PushEvent |
Returns: void
▸ checkSubscription(registration
: ServiceWorkerRegistration, unsubscribe
: boolean): Promise‹PushSubscription | null | void›
Defined in src/utils/checkSubscription.ts:9
Check/Set push notifications subscription
Parameters:
Name | Type | Default |
---|---|---|
registration |
ServiceWorkerRegistration | - |
unsubscribe |
boolean | false |
Returns: Promise‹PushSubscription | null | void›
▸ getLocalStorageParam(key
: string, defaultValue?
: DefaultValue): string | null
Defined in src/utils/getLocalStorageParam.ts:10
Get option from local storage by defined key
Parameters:
Name | Type |
---|---|
key |
string |
defaultValue? |
DefaultValue |
Returns: string | null
▸ isFunction<T>(entity
: T): boolean
Defined in src/utils/isFunction.ts:6
Check if entity is function
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
entity |
T |
Returns: boolean
▸ localStorageParamsMapper(params
: Array‹Array‹DefaultValue››): Array‹string | null›
Defined in src/utils/getLocalStorageParam.ts:31
Get options from local storage by defined keys
Parameters:
Name | Type |
---|---|
params |
Array‹Array‹DefaultValue›› |
Returns: Array‹string | null›
▸ urlBase64ToUint8Array(base64String
: string): Uint8Array
Defined in src/utils/urlBase64ToUint8Array.ts:7
Converts base64 string to Uint8Array
Parameters:
Name | Type | Description |
---|---|---|
base64String |
string | a public vavid key |
Returns: Uint8Array
Defined in src/constants/firebase.ts:2
• apiKey: string = "AIzaSyBlfEue1wp844Hwz16sfBU4dNKPRw941Ng"
Defined in src/constants/firebase.ts:3
• appId: string = "1:0000:web:aaa000000"
Defined in src/constants/firebase.ts:9
• authDomain: string = "your-push-account.firebaseapp.com"
Defined in src/constants/firebase.ts:4
• databaseURL: string = "https://your-push-database.firebaseio.com"
Defined in src/constants/firebase.ts:5
• measurementId: string = "G-WM24X24"
Defined in src/constants/firebase.ts:10
• messagingSenderId: string = "111111111"
Defined in src/constants/firebase.ts:8
• projectId: string = "your-push-rpoject"
Defined in src/constants/firebase.ts:6
• storageBucket: string = "your-push-storage-bucket.appspot.com"
Defined in src/constants/firebase.ts:7