mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-01 09:58:49 +03:00
Remove unused data from KnockoutJS
This commit is contained in:
parent
5cb4d338a1
commit
bf756c9279
6 changed files with 6 additions and 39 deletions
|
|
@ -1,6 +1,5 @@
|
|||
var attrHtmlToJavaScriptMap = { 'class': 'className', 'for': 'htmlFor' };
|
||||
ko.bindingHandlers['attr'] = {
|
||||
'update': (element, valueAccessor, allBindings) => {
|
||||
'update': (element, valueAccessor) => {
|
||||
var value = ko.utils.unwrapObservable(valueAccessor()) || {};
|
||||
ko.utils.objectForEach(value, function(attrName, attrValue) {
|
||||
attrValue = ko.utils.unwrapObservable(attrValue);
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
function makeWithIfBinding(bindingKey, isWith, isNot) {
|
||||
ko.bindingHandlers[bindingKey] = {
|
||||
'init': (element, valueAccessor, allBindings, viewModel, bindingContext) => {
|
||||
var didDisplayOnLastUpdate, savedNodes, contextOptions = {}, needAsyncContext;
|
||||
var savedNodes, contextOptions = {}, needAsyncContext;
|
||||
|
||||
if (isWith) {
|
||||
var as = allBindings.get('as'), noChildContext = false;
|
||||
var as = allBindings.get('as');
|
||||
contextOptions = { 'as': as, 'exportDependencies': true };
|
||||
}
|
||||
|
||||
|
|
@ -52,8 +52,6 @@ function makeWithIfBinding(bindingKey, isWith, isNot) {
|
|||
ko.bindingEvent.notify(element, ko.bindingEvent.childrenComplete);
|
||||
}
|
||||
|
||||
didDisplayOnLastUpdate = shouldDisplay;
|
||||
|
||||
}, { disposeWhenNodeIsRemoved: element });
|
||||
|
||||
return { 'controlsDescendantBindings': true };
|
||||
|
|
|
|||
|
|
@ -17,17 +17,6 @@ ko.bindingHandlers['textInput'] = {
|
|||
}
|
||||
};
|
||||
|
||||
var deferUpdateModel = event => {
|
||||
if (!timeoutHandle) {
|
||||
// The elementValueBeforeEvent variable is set *only* during the brief gap between an
|
||||
// event firing and the updateModel function running. This allows us to ignore model
|
||||
// updates that are from the previous state of the element, usually due to techniques
|
||||
// such as rateLimit. Such updates, if not ignored, can cause keystrokes to be lost.
|
||||
elementValueBeforeEvent = element.value;
|
||||
timeoutHandle = setTimeout(updateModel, 4);
|
||||
}
|
||||
};
|
||||
|
||||
var updateView = () => {
|
||||
var modelValue = ko.utils.unwrapObservable(valueAccessor());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue