mirror of
				https://github.com/avatao-content/frontend-tutorial-framework
				synced 2025-11-04 06:32:55 +00:00 
			
		
		
		
	Implement automatic saving
This commit is contained in:
		@@ -48,6 +48,7 @@ export class WebideComponent implements OnInit {
 | 
			
		||||
    this.requestCode();
 | 
			
		||||
    this.processManagerService.init();
 | 
			
		||||
    this.processManagerService.subscribeCallback('login', (event) => { this.setButtonStateSaved(); });
 | 
			
		||||
    setInterval(() => { this.sendCodeIfDirty(); }, 10000);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  subscribeWS() {
 | 
			
		||||
@@ -99,6 +100,12 @@ export class WebideComponent implements OnInit {
 | 
			
		||||
    this.processManagerService.restartProcess('login');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  sendCodeIfDirty() {
 | 
			
		||||
    if (this.saveButtonState === 'DIRTY') {
 | 
			
		||||
      this.sendCodeContents();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  sendCodeContents() {
 | 
			
		||||
    this.webSocketService.send(this.key_id, {
 | 
			
		||||
      'command': 'write',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user