mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-01-16 03:01:56 +00:00
Optimize tab switching: saving only happens if state is 'DIRTY'
This commit is contained in:
parent
ddc4430bde
commit
685b9755b9
@ -3,7 +3,7 @@
|
|||||||
class="btn btn-secondary"
|
class="btn btn-secondary"
|
||||||
[class.active]="filename === file"
|
[class.active]="filename === file"
|
||||||
[class.disabled]="filename === file"
|
[class.disabled]="filename === file"
|
||||||
(click)="sendCodeContents(); selectCode(file); requestCode()"
|
(click)="tabSwitchButtonHandler(file)"
|
||||||
[disabled]="filename === file">
|
[disabled]="filename === file">
|
||||||
{{file}}
|
{{file}}
|
||||||
</button>
|
</button>
|
||||||
|
@ -76,6 +76,14 @@ export class WebideComponent implements OnInit {
|
|||||||
this.updateFileData(data);
|
this.updateFileData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tabSwitchButtonHandler(file) {
|
||||||
|
if (this.saveButtonState === 'DIRTY') {
|
||||||
|
this.sendCodeContents();
|
||||||
|
}
|
||||||
|
this.selectCode(file);
|
||||||
|
this.requestCode();
|
||||||
|
}
|
||||||
|
|
||||||
setButtonStateSaved() {
|
setButtonStateSaved() {
|
||||||
this.saveButtonState = 'SAVED';
|
this.saveButtonState = 'SAVED';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user