-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve reactive checks (#502)
* feat: improve reactive checks * chore: add new array items as reactive * chore: add polyfil for IE * chore: removed symbols * chore: update readme * Update test/v3/reactivity/reactive.spec.ts * chore: add extra test * chore: removing array sub * chore: fix tests Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
- Loading branch information
Showing
8 changed files
with
89 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
if (!('WeakSet' in window)) { | ||
// simple polyfil for IE | ||
Object.defineProperty(window, 'WeakSet', { | ||
value: new (class { | ||
constructor(private _map = new WeakMap()) {} | ||
has(v: object): boolean { | ||
return this._map.has(v) | ||
} | ||
add(v: object) { | ||
return this._map.set(v, true) | ||
} | ||
remove(v: object) { | ||
return this._map.set(v, true) | ||
} | ||
})(), | ||
}) | ||
} | ||
|
||
export const reactiveSet = new WeakSet() | ||
export const rawSet = new WeakSet() | ||
export const readonlySet = new WeakSet() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters