Skip to content

Commit

Permalink
chore: add context property without rewrite by default
Browse files Browse the repository at this point in the history
  • Loading branch information
foxeyes committed Jun 28, 2022
1 parent cdff087 commit a427b00
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions core/Data.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,12 @@ export class Data {
* @param {unknown} val
* @param {Boolean} [rewrite]
*/
add(prop, val, rewrite = true) {
add(prop, val, rewrite = false) {
if (!rewrite && Object.keys(this.store).includes(prop)) {
return;
}
this.store[prop] = val;
if (this.callbackMap[prop]) {
this.callbackMap[prop].forEach((callback) => {
callback(this.store[prop]);
});
}
this.notify(prop);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"publishConfig": {
"access": "public"
},
"version": "1.8.2",
"version": "1.8.3",
"description": "Symbiote.js",
"author": "[email protected]",
"license": "MIT",
Expand Down

0 comments on commit a427b00

Please sign in to comment.