mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 04:29:21 +03:00
Cleanup knockout subscribables
This commit is contained in:
parent
5748dea4bc
commit
b2a492bdab
27 changed files with 73 additions and 75 deletions
12
dev/External/ko.js
vendored
12
dev/External/ko.js
vendored
|
|
@ -1,7 +1,7 @@
|
|||
import { i18nToNodes } from 'Common/Translator';
|
||||
import { doc, createElement } from 'Common/Globals';
|
||||
import { SaveSettingsStep } from 'Common/Enums';
|
||||
import { arrayLength, isFunction } from 'Common/Utils';
|
||||
import { arrayLength, isFunction, forEachObjectEntry } from 'Common/Utils';
|
||||
|
||||
export const
|
||||
/**
|
||||
|
|
@ -11,6 +11,16 @@ export const
|
|||
*/
|
||||
koComputable = fn => ko.computed(fn, {'pure':true}),
|
||||
|
||||
addObservablesTo = (target, observables) =>
|
||||
forEachObjectEntry(observables, (key, value) =>
|
||||
target[key] = /*isArray(value) ? ko.observableArray(value) :*/ ko.observable(value) ),
|
||||
|
||||
addComputablesTo = (target, computables) =>
|
||||
forEachObjectEntry(computables, (key, fn) => target[key] = koComputable(fn)),
|
||||
|
||||
addSubscribablesTo = (target, subscribables) =>
|
||||
forEachObjectEntry(subscribables, (key, fn) => target[key].subscribe(fn)),
|
||||
|
||||
dispose = disposable => disposable && isFunction(disposable.dispose) && disposable.dispose();
|
||||
|
||||
ko.bindingHandlers.tooltipErrorTip = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue