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

@ -2,7 +2,6 @@ import ko from 'ko';
import { getNotification, i18nToNodes } from 'Common/Translator';
import { addObservablesTo } from 'External/ko';
import { delegateRunOnDestroy } from 'Common/UtilsUser';
import Remote from 'Remote/User/Fetch';
import { FilterModel } from 'Model/Filter';
@ -78,7 +77,6 @@ class SieveScriptPopupView extends AbstractViewPopup {
deleteFilter(filter) {
this.script().filters.remove(filter);
delegateRunOnDestroy(filter);
}
addFilter() {
@ -103,7 +101,6 @@ class SieveScriptPopupView extends AbstractViewPopup {
filters = script.filters(),
index = filters.indexOf(filter);
if (-1 < index) {
delegateRunOnDestroy(filters[index]);
filters[index] = clonedFilter;
script.filters(filters);
}