mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-01 09:58:49 +03:00
Remove some unused KnockoutJS features
This commit is contained in:
parent
f09820d0b9
commit
5839bcf62d
7 changed files with 100 additions and 184 deletions
|
|
@ -18,12 +18,7 @@ ko.bindingHandlers['foreach'] = {
|
|||
return {
|
||||
'foreach': unwrappedValue['data'],
|
||||
'as': unwrappedValue['as'],
|
||||
'noChildContext': unwrappedValue['noChildContext'],
|
||||
'includeDestroyed': unwrappedValue['includeDestroyed'],
|
||||
'afterAdd': unwrappedValue['afterAdd'],
|
||||
'beforeRemove': unwrappedValue['beforeRemove'],
|
||||
'afterRender': unwrappedValue['afterRender'],
|
||||
'beforeMove': unwrappedValue['beforeMove'],
|
||||
'afterMove': unwrappedValue['afterMove']
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,12 +4,11 @@
|
|||
function makeWithIfBinding(bindingKey, isWith, isNot) {
|
||||
ko.bindingHandlers[bindingKey] = {
|
||||
'init': (element, valueAccessor, allBindings, viewModel, bindingContext) => {
|
||||
var didDisplayOnLastUpdate, savedNodes, contextOptions = {}, needAsyncContext, renderOnEveryChange;
|
||||
var didDisplayOnLastUpdate, savedNodes, contextOptions = {}, needAsyncContext;
|
||||
|
||||
if (isWith) {
|
||||
var as = allBindings.get('as'), noChildContext = allBindings.get('noChildContext');
|
||||
renderOnEveryChange = !(as && noChildContext);
|
||||
contextOptions = { 'as': as, 'noChildContext': noChildContext, 'exportDependencies': renderOnEveryChange };
|
||||
var as = allBindings.get('as'), noChildContext = false;
|
||||
contextOptions = { 'as': as, 'exportDependencies': true };
|
||||
}
|
||||
|
||||
needAsyncContext = allBindings['has'](ko.bindingEvent.descendantsComplete);
|
||||
|
|
@ -20,18 +19,12 @@ function makeWithIfBinding(bindingKey, isWith, isNot) {
|
|||
isInitial = !savedNodes,
|
||||
childContext;
|
||||
|
||||
if (!renderOnEveryChange && shouldDisplay === didDisplayOnLastUpdate) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (needAsyncContext) {
|
||||
bindingContext = ko.bindingEvent.startPossiblyAsyncContentBinding(element, bindingContext);
|
||||
}
|
||||
|
||||
if (shouldDisplay) {
|
||||
if (!isWith || renderOnEveryChange) {
|
||||
contextOptions['dataDependency'] = ko.dependencyDetection.computed();
|
||||
}
|
||||
contextOptions['dataDependency'] = ko.dependencyDetection.computed();
|
||||
|
||||
if (isWith) {
|
||||
childContext = bindingContext['createChildContext'](typeof value == "function" ? value : valueAccessor, contextOptions);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue