Skip to content

Commit

Permalink
Cleanup send and send many
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBarba committed Nov 21, 2024
1 parent 99adfed commit 299eb81
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/apns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,14 @@ export class ApnsClient extends EventEmitter {
this._token = null
}

send(notification: Notification) {
return this._send(notification)
}

sendMany(notifications: Notification[]) {
const promises = notifications.map((notification) => {
return this._send(notification).catch((error: ApnsError) => ({ error }))
})
const promises = notifications.map((notification) =>
this.send(notification).catch((error: ApnsError) => ({ error })),
)
return Promise.all(promises)
}

private async _send(notification: Notification) {
async send(notification: Notification) {
const headers: Record<string, string | undefined> = {
authorization: `bearer ${this._getSigningToken()}`,
"apns-push-type": notification.pushType,
Expand Down

0 comments on commit 299eb81

Please sign in to comment.