@frui.ts/dirtycheck
Advanced tools
Comparing version 0.15.0-beta.6 to 0.15.0-rc.1
@@ -0,10 +1,16 @@ | ||
import { PropertyName } from "@frui.ts/helpers"; | ||
import { DirtyPropertiesList, IDirtyWatcher } from "./types"; | ||
export interface DirtyWatchConfig<TTarget> { | ||
exclude?: PropertyName<TTarget>[]; | ||
} | ||
export default class AutomaticDirtyWatcher<TTarget extends Record<string, any>> implements IDirtyWatcher<TTarget> { | ||
private target; | ||
private config?; | ||
isDirtyFlagVisible: boolean; | ||
dirtyProperties: DirtyPropertiesList<TTarget>; | ||
private checkedProperties; | ||
constructor(target: TTarget, isDirtyFlagVisible: boolean); | ||
constructor(target: TTarget, isDirtyFlagVisible: boolean, config?: DirtyWatchConfig<TTarget> | undefined); | ||
get isDirty(): boolean; | ||
reset(): void; | ||
private shouldWatchProperty; | ||
} |
@@ -15,4 +15,5 @@ "use strict"; | ||
var AutomaticDirtyWatcher = (function () { | ||
function AutomaticDirtyWatcher(target, isDirtyFlagVisible) { | ||
function AutomaticDirtyWatcher(target, isDirtyFlagVisible, config) { | ||
this.target = target; | ||
this.config = config; | ||
this.isDirtyFlagVisible = isDirtyFlagVisible; | ||
@@ -35,3 +36,3 @@ this.reset(); | ||
var _a; | ||
if (target.hasOwnProperty(propertyName)) { | ||
if (target.hasOwnProperty(propertyName) && this_1.shouldWatchProperty(propertyName)) { | ||
var originalValue_1 = target[propertyName]; | ||
@@ -56,2 +57,9 @@ helpers_1.ensureObservableProperty(target, propertyName, originalValue_1); | ||
}; | ||
AutomaticDirtyWatcher.prototype.shouldWatchProperty = function (propertyName) { | ||
var _a, _b; | ||
if ((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.exclude) === null || _b === void 0 ? void 0 : _b.includes(propertyName)) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
__decorate([ | ||
@@ -58,0 +66,0 @@ mobx_1.observable, |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "0.15.0-beta.6", | ||
"version": "0.15.0-rc.1", | ||
"description": "Observable dirty checking", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@frui.ts/helpers": "^0.15.0-beta.6" | ||
"@frui.ts/helpers": "^0.15.0-rc.1" | ||
}, | ||
@@ -45,3 +45,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "80cf5a737f5eb5403a155fd4a2e2f36d81c50264" | ||
"gitHead": "94f63f6550f4893c2bbf0ca038560fb2f4b6f2aa" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32004
289