(key: string, value: v)
| 18 | } |
| 19 | |
| 20 | set(key: string, value: v): v { |
| 21 | if (!this.cleanup) return this.pin(key, value) |
| 22 | this.refs.set(key, new WeakRef(value)) |
| 23 | this.cleanup.register(value, key) |
| 24 | return value |
| 25 | } |
| 26 | |
| 27 | pin(key: string, value: v): v { |
| 28 | this.refs.set(key, { deref: () => value }) |