Calling support
This commit is contained in:
parent
83574eb067
commit
d3a27a6442
72 changed files with 3864 additions and 191 deletions
34
ts/services/notify.ts
Normal file
34
ts/services/notify.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
function filter(text: string) {
|
||||
return (text || '')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
}
|
||||
|
||||
type NotificationType = {
|
||||
platform: string;
|
||||
icon: string;
|
||||
message: string;
|
||||
onNotificationClick: () => void;
|
||||
silent: boolean;
|
||||
title: string;
|
||||
};
|
||||
|
||||
export function notify({
|
||||
platform,
|
||||
icon,
|
||||
message,
|
||||
onNotificationClick,
|
||||
silent,
|
||||
title,
|
||||
}: NotificationType): Notification {
|
||||
const notification = new window.Notification(title, {
|
||||
body: platform === 'linux' ? filter(message) : message,
|
||||
icon,
|
||||
silent,
|
||||
});
|
||||
notification.onclick = onNotificationClick;
|
||||
return notification;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue