mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 22:17:03 +03:00
Replaced tricky delegateRunOnDestroy() with koArrayWithDestroy()
koArrayWithDestroy creates ko.observableArray and calls the desired onDestroy() on entry delete.
This commit is contained in:
parent
f4bc796fb1
commit
e324e2f6b6
13 changed files with 32 additions and 55 deletions
|
|
@ -1,8 +1,7 @@
|
|||
import ko from 'ko';
|
||||
import { addObservablesTo } from 'External/ko';
|
||||
import { addObservablesTo, koArrayWithDestroy } from 'External/ko';
|
||||
|
||||
export const AccountUserStore = {
|
||||
accounts: ko.observableArray(),
|
||||
accounts: koArrayWithDestroy(),
|
||||
loading: ko.observable(false).extend({ debounce: 100 }),
|
||||
|
||||
getEmailAddresses: () => AccountUserStore.accounts.map(item => item.email)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import ko from 'ko';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { pInt } from 'Common/Utils';
|
||||
import { addObservablesTo } from 'External/ko';
|
||||
import { addObservablesTo, koArrayWithDestroy } from 'External/ko';
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
export const ContactUserStore = ko.observableArray();
|
||||
export const ContactUserStore = koArrayWithDestroy();
|
||||
|
||||
ContactUserStore.loading = ko.observable(false).extend({ debounce: 200 });
|
||||
ContactUserStore.importing = ko.observable(false).extend({ debounce: 200 });
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import ko from 'ko';
|
||||
import { koArrayWithDestroy } from 'External/ko';
|
||||
|
||||
export const IdentityUserStore = ko.observableArray();
|
||||
export const IdentityUserStore = koArrayWithDestroy();
|
||||
|
||||
IdentityUserStore.getIDS = () => IdentityUserStore.map(item => (item ? item.id() : null))
|
||||
.filter(value => null !== value);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import ko from 'ko';
|
||||
import { koArrayWithDestroy } from 'External/ko';
|
||||
|
||||
export const SieveUserStore = {
|
||||
// capabilities
|
||||
capa: ko.observableArray(),
|
||||
// Sieve scripts SieveScriptModel
|
||||
scripts: ko.observableArray()
|
||||
scripts: koArrayWithDestroy()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue