mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 13:09:21 +03:00
15 lines
542 B
JavaScript
15 lines
542 B
JavaScript
ko.bindingHandlers['visible'] = {
|
|
'update': (element, valueAccessor) => {
|
|
var value = ko.utils.unwrapObservable(valueAccessor());
|
|
var isCurrentlyVisible = !(element.style.display == "none");
|
|
if (value && !isCurrentlyVisible)
|
|
element.style.display = "";
|
|
else if (isCurrentlyVisible && !value)
|
|
element.style.display = "none";
|
|
}
|
|
};
|
|
|
|
ko.bindingHandlers['hidden'] = {
|
|
'update': (element, valueAccessor) =>
|
|
element.hidden = !!ko.utils.unwrapObservable(valueAccessor())
|
|
};
|