The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/views/root/hooks/useDesktopFavicon.ts

19 lines
591 B

import { useAbsoluteUrl, useAssetPath } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';
export const useDesktopFavicon = () => {
const absoluteUrl = useAbsoluteUrl();
useEffect(() => {
if (typeof window === 'undefined') return;
window.RocketChatDesktop?.setUrlResolver((relativePath?: string) => absoluteUrl(relativePath ?? '/'));
}, [absoluteUrl]);
const faviconUrl = useAssetPath('favicon');
useEffect(() => {
if (typeof window === 'undefined') return;
if (!faviconUrl) return;
window.RocketChatDesktop?.setFavicon(faviconUrl);
}, [faviconUrl]);
};