Buckets:
| const { kConnected, kSize } = require('../../core/symbols') | |
| class CompatWeakRef { | |
| constructor (value) { | |
| this.value = value | |
| } | |
| deref () { | |
| return this.value[kConnected] === 0 && this.value[kSize] === 0 | |
| ? undefined | |
| : this.value | |
| } | |
| } | |
| class CompatFinalizer { | |
| constructor (finalizer) { | |
| this.finalizer = finalizer | |
| } | |
| register (dispatcher, key) { | |
| if (dispatcher.on) { | |
| dispatcher.on('disconnect', () => { | |
| if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) { | |
| this.finalizer(key) | |
| } | |
| }) | |
| } | |
| } | |
| unregister (key) {} | |
| } | |
| module.exports = function () { | |
| // FIXME: remove workaround when the Node bug is backported to v18 | |
| // https://github.com/nodejs/node/issues/49344#issuecomment-1741776308 | |
| if (process.env.NODE_V8_COVERAGE && process.version.startsWith('v18')) { | |
| process._rawDebug('Using compatibility WeakRef and FinalizationRegistry') | |
| return { | |
| WeakRef: CompatWeakRef, | |
| FinalizationRegistry: CompatFinalizer | |
| } | |
| } | |
| return { WeakRef, FinalizationRegistry } | |
| } | |
Xet Storage Details
- Size:
- 1.08 kB
- Xet hash:
- 7de390a68eff37b1d9a1a591449f5c677549db2f4e97a447cfa1f43e4b56e59f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.