mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
Improved knockout observables management to prevent memory leaks
This commit is contained in:
parent
b165a1de4f
commit
3eb6ab1ef7
46 changed files with 1020 additions and 1013 deletions
|
|
@ -23,29 +23,33 @@ class LoginAdminView extends AbstractViewNext {
|
|||
|
||||
this.hideSubmitButton = appSettingsGet('hideSubmitButton');
|
||||
|
||||
this.login = ko.observable('');
|
||||
this.password = ko.observable('');
|
||||
this.addObservables({
|
||||
login: '',
|
||||
password: '',
|
||||
|
||||
this.loginError = ko.observable(false);
|
||||
this.passwordError = ko.observable(false);
|
||||
loginError: false,
|
||||
passwordError: false,
|
||||
|
||||
formHidden: false,
|
||||
|
||||
submitRequest: false,
|
||||
submitError: ''
|
||||
});
|
||||
|
||||
this.loginErrorAnimation = ko.observable(false).extend({ 'falseTimeout': 500 });
|
||||
this.passwordErrorAnimation = ko.observable(false).extend({ 'falseTimeout': 500 });
|
||||
|
||||
this.formHidden = ko.observable(false);
|
||||
|
||||
this.formError = ko.computed(() => this.loginErrorAnimation() || this.passwordErrorAnimation());
|
||||
|
||||
this.login.subscribe(() => this.loginError(false));
|
||||
this.addSubscribables({
|
||||
login: () => this.loginError(false),
|
||||
|
||||
this.password.subscribe(() => this.passwordError(false));
|
||||
password: () => this.passwordError(false),
|
||||
|
||||
this.loginError.subscribe(v => this.loginErrorAnimation(!!v));
|
||||
loginError: v => this.loginErrorAnimation(!!v),
|
||||
|
||||
this.passwordError.subscribe(v => this.passwordErrorAnimation(!!v));
|
||||
|
||||
this.submitRequest = ko.observable(false);
|
||||
this.submitError = ko.observable('');
|
||||
passwordError: v => this.passwordErrorAnimation(!!v)
|
||||
});
|
||||
}
|
||||
|
||||
@command((self) => !self.submitRequest())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue