mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-01 01:53:32 +03:00
More Knockout code to ES6
This commit is contained in:
parent
b7cb990b00
commit
cbecdd93a0
22 changed files with 733 additions and 865 deletions
|
|
@ -37,4 +37,4 @@ ko.bindingHandlers['hasfocus'] = {
|
|||
}
|
||||
}
|
||||
};
|
||||
ko.expressionRewriting.twoWayBindings['hasfocus'] = true;
|
||||
ko.expressionRewriting.twoWayBindings.add('hasfocus');
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ ko.bindingHandlers['textInput'] = {
|
|||
ko.computed(updateView, { disposeWhenNodeIsRemoved: element });
|
||||
}
|
||||
};
|
||||
ko.expressionRewriting.twoWayBindings['textInput'] = true;
|
||||
ko.expressionRewriting.twoWayBindings.add('textInput');
|
||||
|
||||
// textinput is an alias for textInput
|
||||
ko.bindingHandlers['textinput'] = {
|
||||
|
|
|
|||
|
|
@ -9,20 +9,18 @@ ko.bindingHandlers['value'] = {
|
|||
return;
|
||||
}
|
||||
|
||||
var eventsToCatch = [];
|
||||
var eventsToCatch = new Set;
|
||||
var requestedEventsToCatch = allBindings.get("valueUpdate");
|
||||
var elementValueBeforeEvent = null;
|
||||
|
||||
if (requestedEventsToCatch) {
|
||||
// Allow both individual event names, and arrays of event names
|
||||
if (typeof requestedEventsToCatch == "string") {
|
||||
eventsToCatch = [requestedEventsToCatch];
|
||||
eventsToCatch.add(requestedEventsToCatch);
|
||||
} else {
|
||||
eventsToCatch = requestedEventsToCatch ? requestedEventsToCatch.filter((item, index) =>
|
||||
requestedEventsToCatch.indexOf(item) === index
|
||||
) : [];
|
||||
requestedEventsToCatch.forEach(item => eventsToCatch.add(item));
|
||||
}
|
||||
ko.utils.arrayRemoveItem(eventsToCatch, "change"); // We'll subscribe to "change" events later
|
||||
eventsToCatch.delete("change"); // We'll subscribe to "change" events later
|
||||
}
|
||||
|
||||
var valueUpdateHandler = () => {
|
||||
|
|
@ -113,4 +111,4 @@ ko.bindingHandlers['value'] = {
|
|||
},
|
||||
'update': () => {} // Keep for backwards compatibility with code that may have wrapped value binding
|
||||
};
|
||||
ko.expressionRewriting.twoWayBindings['value'] = true;
|
||||
ko.expressionRewriting.twoWayBindings.add('value');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue