[Glitch] Converted app/javascript/flavours/glitch/utils/ folder to TypeScript

Port 1142f4c79e to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Josh Goldberg ✨
2023-11-28 18:47:55 +01:00
committed by Claire
parent 52c023a305
commit 695dcc6ca8
10 changed files with 77 additions and 75 deletions

View File

@@ -0,0 +1,13 @@
/**
* 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);
}
};