Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lzxb committed Jul 19, 2024
1 parent 4f64987 commit 8d764d4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 1.4.3

- fix: memory leak caused by unused `@Setup` decorator
- fix: memory leak caused by unused `@Setup` decorator

## 1.4.2

- fix: Type failure
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-class-setup",
"version": "1.4.2",
"version": "1.4.3",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
Expand Down
11 changes: 5 additions & 6 deletions src/setup-reference.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

let count = 0;
let isOpen = false;

export function add () {
export function add() {
if (isOpen) {
count = 1;
} else {
Expand All @@ -18,22 +17,22 @@ export function popTarget(target: object): boolean {
if (typeof count === 'number') {
count--;
if (count) {
weakMap.set(target, count)
weakMap.set(target, count);
return false;
} else {
weakMap.delete(target);
isOpen = false
isOpen = false;
return true;
}
}
return false
return false;
}

export function bindTarget(target: object) {
if (count > 0) {
weakMap.set(target, count);
count = 0;
} else {
console.warn(`The instance did not use the '@Setup' decorator`)
console.warn(`The instance did not use the '@Setup' decorator`);
}
}

0 comments on commit 8d764d4

Please sign in to comment.