mirror of
				https://github.com/avatao-content/frontend-tutorial-framework
				synced 2025-11-04 12:42:55 +00:00 
			
		
		
		
	Fix reload event overwriting your code for the nth time
This commit is contained in:
		@@ -34,7 +34,7 @@
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div (keyup)="setCodeState('DIRTY'); setDeployButtonState('TODEPLOY'); resetAutoSaveCountdown()"
 | 
			
		||||
<div (keyup)="setCodeState('DIRTY'); setDeployButtonState('TODEPLOY')"
 | 
			
		||||
  ace-editor
 | 
			
		||||
  [(text)]="code"
 | 
			
		||||
  [mode]="language"
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ export class WebideComponent implements OnInit {
 | 
			
		||||
    this.processManagerService.init();
 | 
			
		||||
    this.processManagerService.subscribeCallback(config.webide.deployProcessName, (event) => { this.setDeployButtonState('DEPLOYED'); });
 | 
			
		||||
    this.processManagerService.subscribeErrorCallback(config.webide.deployProcessName, (event) => { this.setDeployButtonState('FAILED'); });
 | 
			
		||||
    this.resetAutoSaveCountdown();
 | 
			
		||||
    setInterval(() => { this.sendCodeIfDirty(); }, config.webide.autoSaveInterval);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  subscribeWS() {
 | 
			
		||||
@@ -82,8 +82,9 @@ export class WebideComponent implements OnInit {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  readHandler(data: SourceCode) {
 | 
			
		||||
    this.updateFileData(data);
 | 
			
		||||
    this.setCodeState('SAVED');
 | 
			
		||||
    if (this.codeState == 'SAVED') {
 | 
			
		||||
      this.updateFileData(data);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  writeHandler() {
 | 
			
		||||
@@ -94,13 +95,6 @@ export class WebideComponent implements OnInit {
 | 
			
		||||
    this.updateFileData(data);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  resetAutoSaveCountdown() {
 | 
			
		||||
    if (this.autosave) {
 | 
			
		||||
      clearInterval(this.autosave);
 | 
			
		||||
    }
 | 
			
		||||
    this.autosave = setInterval(() => { this.sendCodeIfDirty(); }, config.webide.autoSaveInterval);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  tabSwitchButtonHandler(file) {
 | 
			
		||||
    if (this.codeState === 'DIRTY') {
 | 
			
		||||
      this.sendCodeContents();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user