( text: string, callbackUrl: string, callbackFn: (callbackUrl: string) => void = defaultCallback )
| 12 | }; |
| 13 | |
| 14 | export const notify = ( |
| 15 | text: string, |
| 16 | callbackUrl: string, |
| 17 | callbackFn: (callbackUrl: string) => void = defaultCallback |
| 18 | ): void => { |
| 19 | console.log({ text, callbackUrl }); |
| 20 | if (window.Notification && isNotificationEnabled()) { |
| 21 | const notification = new window.Notification('Linen Notification', { |
| 22 | body: text, |
| 23 | }); |
| 24 | if (!!callbackUrl) { |
| 25 | notification.onclick = (event) => { |
| 26 | event.preventDefault(); |
| 27 | callbackFn(callbackUrl); |
| 28 | }; |
| 29 | } |
| 30 | } |
| 31 | }; |
no test coverage detected