Fix: stop live-reload and refresh the page when style is removed
This commit is contained in:
		
							parent
							
								
									0852b56ce4
								
							
						
					
					
						commit
						2b6404cb11
					
				| 
						 | 
				
			
			@ -189,6 +189,16 @@ function initLiveReload(sourceLoader) {
 | 
			
		|||
      watcher.start();
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
  chrome.runtime.onMessage.addListener(request => {
 | 
			
		||||
    if (request.method === 'styleDeleted') {
 | 
			
		||||
      if (installed && installed.id === request.id) {
 | 
			
		||||
        installed = null;
 | 
			
		||||
        watcher.stop();
 | 
			
		||||
        $('.live-reload-checkbox').checked = false;
 | 
			
		||||
        location.reload();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
  $('.actions').appendChild($element({tag: 'label', className: 'live-reload', appendChild: [
 | 
			
		||||
    $element({tag: 'input', type: 'checkbox', className: 'live-reload-checkbox'}),
 | 
			
		||||
    $element({tag: 'span', textContent: t('liveReloadLabel')})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user