mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-26 16:26:44 +03:00
Switch from ko.computed to ko.pureComputed
This should provide performance and memory benefits over regular computed observables
This commit is contained in:
parent
ac2238a23f
commit
954de06f86
18 changed files with 55 additions and 37 deletions
|
|
@ -2,6 +2,7 @@ import ko from 'ko';
|
|||
import { pInt } from 'Common/Utils';
|
||||
import { SaveSettingsStep } from 'Common/Enums';
|
||||
import { AbstractComponent } from 'Component/Abstract';
|
||||
import { koComputable } from 'External/ko';
|
||||
|
||||
class AbstractInput extends AbstractComponent {
|
||||
/**
|
||||
|
|
@ -18,7 +19,7 @@ class AbstractInput extends AbstractComponent {
|
|||
|
||||
this.labeled = null != params.label;
|
||||
|
||||
let size = params.size || 0;
|
||||
let size = 0 < params.size ? 'span' + params.size : '';
|
||||
if (this.trigger) {
|
||||
const
|
||||
classForTrigger = ko.observable(''),
|
||||
|
|
@ -38,13 +39,13 @@ class AbstractInput extends AbstractComponent {
|
|||
|
||||
setTriggerState(this.trigger());
|
||||
|
||||
this.className = ko.computed(() =>
|
||||
((0 < size ? 'span' + size : '') + ' settings-saved-trigger-input ' + classForTrigger()).trim()
|
||||
this.className = koComputable(() =>
|
||||
(size + ' settings-saved-trigger-input ' + classForTrigger()).trim()
|
||||
);
|
||||
|
||||
this.disposable.push(this.trigger.subscribe(setTriggerState, this));
|
||||
} else {
|
||||
this.className = ko.computed(() => 0 < size ? 'span' + size : '');
|
||||
this.className = size;
|
||||
}
|
||||
|
||||
this.disposable.push(this.className);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue