Settings: correct safe area emu hot reload
This commit is contained in:
		
							parent
							
								
									5742932c86
								
							
						
					
					
						commit
						2da07a8d01
					
				
					 1 changed files with 8 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -141,11 +141,16 @@ function setupSafeAreaEmulation(name: string) {
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const $$SAFE_AREA_EMU = "$$SAFE_AREA_EMU";
 | 
			
		||||
 | 
			
		||||
if (import.meta.hot) {
 | 
			
		||||
  import.meta.hot.accept((mod) => {
 | 
			
		||||
    if (!mod) return;
 | 
			
		||||
  import.meta.hot.on("vite:beforeUpdate", () => {
 | 
			
		||||
    import.meta.hot!.data[$$SAFE_AREA_EMU] = screenOrientationCallback;
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  import.meta.hot.on("vite:afterUpdate", () => {
 | 
			
		||||
    screenOrientationCallback = import.meta.hot?.data?.[$$SAFE_AREA_EMU];
 | 
			
		||||
    if (screenOrientationCallback) {
 | 
			
		||||
      mod["screenOrientationCallback"] = screenOrientationCallback;
 | 
			
		||||
      setTimeout(screenOrientationCallback, 0);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue