Skip to content

Commit

Permalink
Path Ids ferature
Browse files Browse the repository at this point in the history
  • Loading branch information
seyacat committed Jan 2, 2024
1 parent 7e80156 commit c961413
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions reactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ function Reactive(
}
},
triggerSubs: function (data) {
let { prop, path, value, oldValue } = data;
path = path ? path : [prop];
let { prop, path, pathIds, value, oldValue } = data;

if (!path) {
path = [prop];
pathIds = [value?._obId];
}

const pathString = path.join(".");
const localpath = path;

Expand Down Expand Up @@ -110,8 +115,9 @@ function Reactive(
base: this.receiver,
prop,
path,
pathIds,
pathString,
value: value,
value: value?._isReactive ? value._ : value,
oldValue,
pathValues,
prefix: this._prefix,
Expand All @@ -132,8 +138,9 @@ function Reactive(
base: this.receiver,
prop,
path,
pathIds,
pathString,
value: value ?? valueThoughtLocalPath,
value: value?._isReactive ? value._ : value,
oldValue,
pathValues,
prefix: this._prefix,
Expand All @@ -153,6 +160,7 @@ function Reactive(
})({
prop,
path: [parent.prop, ...path],
pathIds: [parent.receiver._obId, ...pathIds],
value: value,
pathValues,
oldValue,
Expand Down Expand Up @@ -386,8 +394,8 @@ function Reactive(
target.triggerSubs.bind({ target, receiver })({
prop,
path: receiver._path,
value: value?._isReactive ? value._ : value,
oldValue: oldValue?._isReactive ? oldValue._ : oldValue,
value: value,
oldValue: oldValue,
});

return true;
Expand Down

0 comments on commit c961413

Please sign in to comment.