Replaced tricky delegateRunOnDestroy() with koArrayWithDestroy()

koArrayWithDestroy creates ko.observableArray and calls the desired onDestroy() on entry delete.
This commit is contained in:
the-djmaze 2022-02-17 12:48:57 +01:00
parent f4bc796fb1
commit e324e2f6b6
13 changed files with 32 additions and 55 deletions

View file

@ -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)