Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/leanplum.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class Leanplum {
* Unregisters the browser form web push.
* @return {Promise} Resolves on success, otherwise rejects.
*/
static unregisterFromWebPush(): Promise<string>;
static unregisterFromWebPush(): Promise<void>;
/**
* Clears cached values for messages, variables and test assignments.
* Use sparingly as if the app is updated, you'll have to deal with potentially
Expand Down
4 changes: 2 additions & 2 deletions dist/leanplum.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/leanplum.min.js

Large diffs are not rendered by default.

22 changes: 10 additions & 12 deletions src/Leanplum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,25 +443,23 @@ Use "npm update leanplum-sdk" or go to https://docs.leanplum.com/reference#javas
* otherwise fails.
*/
static registerForWebPush(serviceWorkerUrl?: string): Promise<boolean> {
return new Promise((resolve, reject) => {
if (Leanplum._pushManager.isWebPushSupported()) {
return Leanplum._pushManager.register(serviceWorkerUrl, (isSubscribed) => {
if (isSubscribed) {
return resolve(true)
}
return Leanplum._pushManager.subscribeUser()
})
} else {
return reject('Leanplum: WebPush is not supported.')
}
})
return Leanplum._pushManager.register(serviceWorkerUrl, (isSubscribed) => {
if (isSubscribed) {
return Promise.resolve(true)
}
return Leanplum._pushManager.subscribeUser()
})
} else {
return Promise.reject('Leanplum: WebPush is not supported.')
}
}

/**
* Unregisters the browser form web push.
* @return {Promise} Resolves on success, otherwise rejects.
*/
static unregisterFromWebPush(): Promise<string> {
static unregisterFromWebPush(): Promise<void> {
return Leanplum._pushManager.unsubscribeUser()
}

Expand Down
4 changes: 2 additions & 2 deletions src/LeanplumSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import isEqual from 'lodash/isEqual'
import ArgsBuilder from './ArgsBuilder'
import Constants from './Constants'
import LeanplumRequest from './LeanplumRequest'
import SocketIoClient from './SocketIoClient'
import { CreateRequestFunction } from './types'
import VarCache from './VarCache'

export default class LeanplumSocket {
Expand All @@ -29,7 +29,7 @@ export default class LeanplumSocket {
public connect(
cache: VarCache,
auth: { appId: string, deviceId: string },
createRequest: (action: string, args: ArgsBuilder, options: any) => void,
createRequest: CreateRequestFunction,
getLastResponse: (response: any) => any
): void {
if (!WebSocket) {
Expand Down
Loading