mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
More ko.computed to pureComputed
This commit is contained in:
parent
a15454fd15
commit
679d7356e0
8 changed files with 46 additions and 50 deletions
|
|
@ -34,7 +34,7 @@ export const
|
|||
target[key] = /*isArray(value) ? ko.observableArray(value) :*/ ko.observable(value) ),
|
||||
|
||||
addComputablesTo = (target, computables) =>
|
||||
forEachObjectEntry(computables, (key, fn) => target[key] = ko.computed(fn)),
|
||||
forEachObjectEntry(computables, (key, fn) => target[key] = ko.computed(fn, {'pure':true})),
|
||||
|
||||
addSubscribablesTo = (target, subscribables) =>
|
||||
forEachObjectEntry(subscribables, (key, fn) => target[key].subscribe(fn)),
|
||||
|
|
|
|||
2
dev/External/ko.js
vendored
2
dev/External/ko.js
vendored
|
|
@ -8,7 +8,7 @@ import { arrayLength, isFunction } from 'Common/Utils';
|
|||
* number of evaluations or other “hidden” information. Its value should be
|
||||
* based solely on the values of other observables in the application
|
||||
*/
|
||||
export const koComputable = ko.pureComputed;
|
||||
export const koComputable = fn => ko.computed(fn, {'pure':true});
|
||||
|
||||
ko.bindingHandlers.tooltipErrorTip = {
|
||||
init: (element, fValueAccessor) => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { koComputable } from 'External/ko';
|
||||
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { ContactUserStore } from 'Stores/User/Contact';
|
||||
|
|
@ -14,8 +15,7 @@ export class ContactsUserSettings /*extends AbstractViewSettings*/ {
|
|||
this.contactsSyncUser = ContactUserStore.syncUser;
|
||||
this.contactsSyncPass = ContactUserStore.syncPass;
|
||||
|
||||
this.saveTrigger = ko
|
||||
.computed(() =>
|
||||
this.saveTrigger = koComputable(() =>
|
||||
[
|
||||
ContactUserStore.enableSync() ? '1' : '0',
|
||||
ContactUserStore.syncUrl(),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { koComputable } from 'External/ko';
|
||||
|
||||
import { Scope, Notification } from 'Common/Enums';
|
||||
import { MessageSetAction } from 'Common/EnumsUser';
|
||||
|
|
@ -149,16 +150,13 @@ export const MessageUserStore = new class {
|
|||
}
|
||||
});
|
||||
|
||||
this.listChecked = ko
|
||||
.computed(() => this.list.filter(isChecked))
|
||||
this.listChecked = koComputable(() => this.list.filter(isChecked))
|
||||
.extend({ rateLimit: 0 });
|
||||
|
||||
this.hasCheckedMessages = ko
|
||||
.computed(() => !!this.list.find(isChecked))
|
||||
this.hasCheckedMessages = koComputable(() => !!this.list.find(isChecked))
|
||||
.extend({ rateLimit: 0 });
|
||||
|
||||
this.hasCheckedOrSelected = ko
|
||||
.computed(() => !!(this.selectorMessageSelected()
|
||||
this.hasCheckedOrSelected = koComputable(() => !!(this.selectorMessageSelected()
|
||||
|| this.selectorMessageFocused()
|
||||
|| this.list.find(item => item.checked())))
|
||||
.extend({ rateLimit: 50 });
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { koComputable } from 'External/ko';
|
||||
|
||||
import Remote from 'Remote/Admin/Fetch';
|
||||
|
||||
|
|
@ -16,8 +17,7 @@ class PaneSettingsAdminView extends AbstractViewRight {
|
|||
|
||||
this.leftPanelDisabled = leftPanelDisabled;
|
||||
|
||||
this.adminManLoadingVisibility = ko
|
||||
.computed(() => PackageAdminStore.loading() ? 'visible' : 'hidden');
|
||||
this.adminManLoadingVisibility = koComputable(() => PackageAdminStore.loading() ? 'visible' : 'hidden');
|
||||
}
|
||||
|
||||
logoutClick() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue