mirror of
				https://github.com/owncast/owncast.git
				synced 2025-10-31 18:18:06 +08:00 
			
		
		
		
	 c05a20a460
			
		
	
	c05a20a460
	
	
	
		
			
			Instead of doing manual layout switching use the Nextjs nested layout support. Also add some additional lazy loading of components. This is to work on performance score re: #2167.
		
			
				
	
	
		
			28 lines
		
	
	
		
			669 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			669 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /* eslint-disable react/no-danger */
 | |
| import { FC, useEffect } from 'react';
 | |
| 
 | |
| export const PushNotificationServiceWorker: FC = () => {
 | |
|   const add = () => {
 | |
|     navigator.serviceWorker.register('/serviceWorker.js').then(
 | |
|       registration => {
 | |
|         console.debug('Service Worker registration successful with scope: ', registration.scope);
 | |
|       },
 | |
|       err => {
 | |
|         console.error('Service Worker registration failed: ', err);
 | |
|       },
 | |
|     );
 | |
|   };
 | |
| 
 | |
|   useEffect(() => {
 | |
|     if ('serviceWorker' in navigator) {
 | |
|       window.addEventListener('load', add);
 | |
|     }
 | |
| 
 | |
|     return () => {
 | |
|       window.removeEventListener('load', add);
 | |
|     };
 | |
|   }, []);
 | |
| 
 | |
|   return null;
 | |
| };
 |