(data: any)
| 408 | } |
| 409 | |
| 410 | private async handlePush(data: any): Promise<void> { |
| 411 | await this.broadcast({ |
| 412 | type: 'PUSH', |
| 413 | data, |
| 414 | }); |
| 415 | if (!data.notification || !data.notification.title) { |
| 416 | return; |
| 417 | } |
| 418 | const desc = data.notification as {[key: string]: string | undefined}; |
| 419 | let options: {[key: string]: string | undefined} = {}; |
| 420 | NOTIFICATION_OPTION_NAMES.filter((name) => desc.hasOwnProperty(name)).forEach( |
| 421 | (name) => (options[name] = desc[name]), |
| 422 | ); |
| 423 | await this.scope.registration.showNotification(desc['title']!, options); |
| 424 | } |
| 425 | |
| 426 | private async handleClick(notification: Notification, action?: string): Promise<void> { |
| 427 | notification.close(); |
no test coverage detected