mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-24 12:48:07 +01:00
695dcc6ca8
Port 1142f4c79e
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
13 lines
380 B
TypeScript
13 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);
|
|
}
|
|
};
|