mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 22:47:03 +03:00
Cleanup JS and better terser compression
This commit is contained in:
parent
058217de02
commit
ba7ed497b2
20 changed files with 247 additions and 298 deletions
|
|
@ -392,7 +392,7 @@
|
|||
|
||||
// Get the binding from the provider within a computed observable so that we can update the bindings whenever
|
||||
// the binding context is updated or if the binding provider accesses observables.
|
||||
var bindingsUpdater = ko.dependentObservable(
|
||||
var bindingsUpdater = ko.computed(
|
||||
() => {
|
||||
bindings = sourceBindings ? sourceBindings(bindingContext, node) : getBindings.call(provider, node, bindingContext);
|
||||
// Register a dependency on the binding context to support observable view models.
|
||||
|
|
@ -485,7 +485,7 @@
|
|||
|
||||
// Run update in its own computed wrapper
|
||||
if (typeof handlerUpdateFn == "function") {
|
||||
ko.dependentObservable(
|
||||
ko.computed(
|
||||
() => handlerUpdateFn(node, getValueAccessor(bindingKey), allBindings, contextToExtend['$data'], contextToExtend),
|
||||
null,
|
||||
{ disposeWhenNodeIsRemoved: node }
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
function mapNodeAndRefreshWhenChanged(containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) {
|
||||
// Map this array value inside a dependentObservable so we re-map when any dependency changes
|
||||
var mappedNodes = [];
|
||||
var dependentObservable = ko.dependentObservable(() => {
|
||||
var dependentObservable = ko.computed(() => {
|
||||
var newMappedNodes = mapping(valueToMap, index, ko.utils.fixUpContinuousNodeArray(mappedNodes, containerNode)) || [];
|
||||
|
||||
// On subsequent evaluations, just replace the previously-inserted DOM nodes
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
var computedState = Symbol('_state');
|
||||
|
||||
ko.computed = ko.dependentObservable = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {
|
||||
ko.computed = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {
|
||||
if (typeof evaluatorFunctionOrOptions === "object") {
|
||||
// Single-parameter syntax - everything is on this "options" param
|
||||
options = evaluatorFunctionOrOptions;
|
||||
|
|
@ -498,7 +498,6 @@ ko.isComputed = instance => (typeof instance == 'function' && instance[protoProp
|
|||
ko.isPureComputed = instance => ko.isComputed(instance) && instance[computedState] && instance[computedState].pure;
|
||||
|
||||
ko.exportSymbol('computed', ko.computed);
|
||||
ko.exportSymbol('dependentObservable', ko.computed); // export ko.dependentObservable for backwards compatibility (1.x)
|
||||
ko.exportSymbol('isComputed', ko.isComputed);
|
||||
ko.exportSymbol('isPureComputed', ko.isPureComputed);
|
||||
ko.exportSymbol('computed.fn', computedFn);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ ko.extenders = {
|
|||
// (2) For writable targets (observables, or writable dependent observables), we throttle *writes*
|
||||
// so the target cannot change value synchronously or faster than a certain rate
|
||||
var writeTimeoutInstance = null;
|
||||
return ko.dependentObservable({
|
||||
return ko.computed({
|
||||
'read': target,
|
||||
'write': value => {
|
||||
clearTimeout(writeTimeoutInstance);
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@
|
|||
var whenToDispose = () => (!firstTargetNode) || !ko.utils.domNodeIsAttachedToDocument(firstTargetNode); // Passive disposal (on next evaluation)
|
||||
var activelyDisposeWhenNodeIsRemoved = (firstTargetNode && renderMode == "replaceNode") ? firstTargetNode.parentNode : firstTargetNode;
|
||||
|
||||
return ko.dependentObservable( // So the DOM is automatically updated when any dependency changes
|
||||
return ko.computed( // So the DOM is automatically updated when any dependency changes
|
||||
() => {
|
||||
// Ensure we've got a proper binding context to work with
|
||||
var bindingContext = (dataOrBindingContext && (dataOrBindingContext instanceof ko.bindingContext))
|
||||
|
|
@ -218,7 +218,7 @@
|
|||
|
||||
return subscription;
|
||||
} else {
|
||||
return ko.dependentObservable(() => {
|
||||
return ko.computed(() => {
|
||||
var unwrappedArray = ko.utils.unwrapObservable(arrayOrObservableArray) || [];
|
||||
if (typeof unwrappedArray.length == "undefined") // Coerce single value into array
|
||||
unwrappedArray = [unwrappedArray];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue