mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 14:37:02 +03:00
Remove knockout evaluatorFunctionTarget
Drop deprecated knockout throttle extender Added knockout debounce extender
This commit is contained in:
parent
b9b0a550d6
commit
75b7176ada
15 changed files with 158 additions and 226 deletions
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
// When a "parent" context is given and we don't already have a dependency on its context, register a dependency on it.
|
||||
// Thus whenever the parent context is updated, this context will also be updated.
|
||||
if (parentContext && parentContext[contextSubscribable] && !ko.computedContext.computed().hasAncestorDependency(parentContext[contextSubscribable])) {
|
||||
if (parentContext && parentContext[contextSubscribable] && !ko.dependencyDetection.computed().hasAncestorDependency(parentContext[contextSubscribable])) {
|
||||
parentContext[contextSubscribable]();
|
||||
}
|
||||
|
||||
|
|
@ -374,7 +374,7 @@
|
|||
}
|
||||
return bindings;
|
||||
},
|
||||
null, { disposeWhenNodeIsRemoved: node }
|
||||
{ disposeWhenNodeIsRemoved: node }
|
||||
);
|
||||
|
||||
if (!bindings || !bindingsUpdater.isActive())
|
||||
|
|
@ -453,7 +453,6 @@
|
|||
if (typeof handlerUpdateFn == "function") {
|
||||
ko.computed(
|
||||
() => handlerUpdateFn(node, getValueAccessor(bindingKey), allBindings, contextToExtend['$data'], contextToExtend),
|
||||
null,
|
||||
{ disposeWhenNodeIsRemoved: node }
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,9 @@ ko.bindingHandlers['html'] = {
|
|||
let html = ko.utils.unwrapObservable(valueAccessor());
|
||||
|
||||
if (html != null) {
|
||||
if (typeof html != 'string')
|
||||
html = html.toString();
|
||||
|
||||
const template = document.createElement('template');
|
||||
template.innerHTML = html;
|
||||
element.appendChild(template.content);
|
||||
const template = document.createElement('template');
|
||||
template.innerHTML = typeof html != 'string' ? html.toString() : html;
|
||||
element.appendChild(template.content);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ function makeWithIfBinding(bindingKey, isWith, isNot) {
|
|||
|
||||
if (shouldDisplay) {
|
||||
if (!isWith || renderOnEveryChange) {
|
||||
contextOptions['dataDependency'] = ko.computedContext.computed();
|
||||
contextOptions['dataDependency'] = ko.dependencyDetection.computed();
|
||||
}
|
||||
|
||||
if (isWith) {
|
||||
childContext = bindingContext['createChildContext'](typeof value == "function" ? value : valueAccessor, contextOptions);
|
||||
} else if (ko.computedContext.getDependenciesCount()) {
|
||||
} else if (ko.dependencyDetection.getDependenciesCount()) {
|
||||
childContext = bindingContext['extend'](null, contextOptions);
|
||||
} else {
|
||||
childContext = bindingContext;
|
||||
|
|
@ -44,7 +44,7 @@ function makeWithIfBinding(bindingKey, isWith, isNot) {
|
|||
}
|
||||
|
||||
// Save a copy of the inner nodes on the initial update, but only if we have dependencies.
|
||||
if (isInitial && ko.computedContext.getDependenciesCount()) {
|
||||
if (isInitial && ko.dependencyDetection.getDependenciesCount()) {
|
||||
savedNodes = ko.utils.cloneNodes(ko.virtualElements.childNodes(element), true /* shouldCleanNodes */);
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ function makeWithIfBinding(bindingKey, isWith, isNot) {
|
|||
|
||||
didDisplayOnLastUpdate = shouldDisplay;
|
||||
|
||||
}, null, { disposeWhenNodeIsRemoved: element });
|
||||
}, { disposeWhenNodeIsRemoved: element });
|
||||
|
||||
return { 'controlsDescendantBindings': true };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ ko.bindingHandlers['options'] = {
|
|||
}
|
||||
}
|
||||
|
||||
if (valueAllowUnset || ko.computedContext.isInitial()) {
|
||||
if (valueAllowUnset || ko.dependencyDetection.isInitial()) {
|
||||
ko.bindingEvent.notify(element, ko.bindingEvent.childrenComplete);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ ko.bindingHandlers['textInput'] = {
|
|||
// To deal with browsers that don't notify any kind of event for some changes (IE, Safari, etc.)
|
||||
onEvent('blur', updateModel);
|
||||
|
||||
ko.computed(updateView, null, { disposeWhenNodeIsRemoved: element });
|
||||
ko.computed(updateView, { disposeWhenNodeIsRemoved: element });
|
||||
}
|
||||
};
|
||||
ko.expressionRewriting.twoWayBindings['textInput'] = true;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ ko.bindingHandlers['value'] = {
|
|||
ko.bindingEvent.subscribe(element, ko.bindingEvent.childrenComplete, () => {
|
||||
if (!updateFromModelComputed) {
|
||||
ko.utils.registerEventHandler(element, "change", valueUpdateHandler);
|
||||
updateFromModelComputed = ko.computed(updateFromModel, null, { disposeWhenNodeIsRemoved: element });
|
||||
updateFromModelComputed = ko.computed(updateFromModel, { disposeWhenNodeIsRemoved: element });
|
||||
} else if (allBindings.get('valueAllowUnset')) {
|
||||
updateFromModel();
|
||||
} else {
|
||||
|
|
@ -108,7 +108,7 @@ ko.bindingHandlers['value'] = {
|
|||
}, null, { 'notifyImmediately': true });
|
||||
} else {
|
||||
ko.utils.registerEventHandler(element, "change", valueUpdateHandler);
|
||||
ko.computed(updateFromModel, null, { disposeWhenNodeIsRemoved: element });
|
||||
ko.computed(updateFromModel, { disposeWhenNodeIsRemoved: element });
|
||||
}
|
||||
},
|
||||
'update': () => {} // Keep for backwards compatibility with code that may have wrapped value binding
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
// of which nodes would be deleted if valueToMap was itself later removed
|
||||
mappedNodes.length = 0;
|
||||
mappedNodes.push(...newMappedNodes);
|
||||
}, null, { disposeWhenNodeIsRemoved: containerNode, disposeWhen: ()=>!!mappedNodes.find(ko.utils.domNodeIsAttachedToDocument) });
|
||||
}, { disposeWhenNodeIsRemoved: containerNode, disposeWhen: ()=>!!mappedNodes.find(ko.utils.domNodeIsAttachedToDocument) });
|
||||
return { mappedNodes : mappedNodes, dependentObservable : (dependentObservable.isActive() ? dependentObservable : undefined) };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue