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