mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +03:00
Improved knockout observables management to prevent memory leaks
This commit is contained in:
parent
b165a1de4f
commit
3eb6ab1ef7
46 changed files with 1020 additions and 1013 deletions
15
dev/External/ko.js
vendored
15
dev/External/ko.js
vendored
|
|
@ -262,4 +262,19 @@ ko.observable.fn.deleteAccessHelper = function() {
|
|||
return this;
|
||||
};
|
||||
|
||||
ko.addObservablesTo = (target, observables) => {
|
||||
Object.entries(observables).forEach(([key, value]) => target[key] = ko.observable(value) );
|
||||
/*
|
||||
Object.entries(observables).forEach(([key, value]) =>
|
||||
target[key] = Array.isArray(value) ? ko.observableArray(value) : ko.observable(value)
|
||||
);
|
||||
*/
|
||||
};
|
||||
|
||||
ko.addComputablesTo = (target, computables) =>
|
||||
Object.entries(computables).forEach(([key, fn]) => target[key] = ko.computed(fn));
|
||||
|
||||
ko.addSubscribablesTo = (target, subscribables) =>
|
||||
Object.entries(subscribables).forEach(([key, fn]) => target[key].subscribe(fn));
|
||||
|
||||
export default ko;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue