Improved observables

This commit is contained in:
djmaze 2020-10-27 11:09:24 +01:00
parent 8d7e25fc7c
commit 7db7d5545b
28 changed files with 236 additions and 234 deletions

View file

@ -287,15 +287,4 @@ ko.extenders.specialThrottle = (target, timeout) => {
return target;
};
// functions
ko.observable.fn.validateEmail = function() {
this.hasError = ko.observable(false);
this.subscribe(value => this.hasError(value && !/^[^@\s]+@[^@\s]+$/.test(value)));
this.valueHasMutated();
return this;
};
export default ko;

4
dev/External/ko.js vendored
View file

@ -36,7 +36,6 @@ ko.bindingHandlers.tooltip = {
ko.bindingHandlers.tooltipErrorTip = {
init: element => {
doc.addEventListener('click', () => element.removeAttribute('data-rainloopErrorTip'));
ko.utils.domNodeDisposal.addDisposeCallback(element, () => element.removeAttribute('data-rainloopErrorTip'));
},
update: (element, fValueAccessor) => {
const value = koValue(fValueAccessor());
@ -258,8 +257,7 @@ ko.extenders.falseTimeout = (target, option) => {
// functions
ko.observable.fn.deleteAccessHelper = function() {
this.extend({ falseTimeout: 3000 }).extend({ toggleSubscribeProperty: [this, 'deleteAccess'] });
return this;
return this.extend({ falseTimeout: 3000, toggleSubscribeProperty: [this, 'deleteAccess'] });
};
ko.addObservablesTo = (target, observables) => {