mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-27 03:31:36 +01:00
14 lines
380 B
TypeScript
14 lines
380 B
TypeScript
|
/**
|
||
|
* Tries Notification.requestPermission, console warning instead of rejecting on error.
|
||
|
* @param callback Runs with the permission result on completion.
|
||
|
*/
|
||
|
export const requestNotificationPermission = async (
|
||
|
callback: NotificationPermissionCallback,
|
||
|
) => {
|
||
|
try {
|
||
|
callback(await Notification.requestPermission());
|
||
|
} catch (error) {
|
||
|
console.warn(error);
|
||
|
}
|
||
|
};
|