Fix oversights in forwarded state caching
This commit is contained in:
parent
99d791921e
commit
b46c5d1d5c
2 changed files with 3 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "skooma",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"author": "darkwiiplayer",
|
||||
"license": "Unlicense",
|
||||
"main": "skooma.js",
|
||||
|
|
4
state.js
4
state.js
|
@ -88,12 +88,12 @@ export class State extends EventTarget {
|
|||
|
||||
forward(property="value", fallback) {
|
||||
if (!this.#forwardCache) this.#forwardCache = new Map()
|
||||
const cached = this.#forwardCache.get(property).deref()
|
||||
const cached = this.#forwardCache.get(property)?.deref()
|
||||
if (cached) {
|
||||
return cached
|
||||
} else {
|
||||
const forwarded = new ForwardState(this, property, fallback)
|
||||
ref = new Weakref(forwarded)
|
||||
const ref = new WeakRef(forwarded)
|
||||
this.#forwardCache.set(property, ref)
|
||||
forwardFinalizationRegistry.register(forwarded, [this.#forwardCache, property])
|
||||
return forwarded
|
||||
|
|
Loading…
Reference in a new issue