new WeakRef(target, ttl)
Initializes the weak reference to the target reference.
Parameters:
Name | Type | Description |
---|---|---|
target |
Object | The target reference that should be referenced by this weak reference. |
ttl |
number | The maximum number of milliseconds the weak reference should be kept. The reference will be discarded once ACCESSED after the specified timeout. |
Members
-
_expiration :number
-
The UNIX timestamp with millisecond precision marking the moment at or after which the reference will be discarded.
Type:
- number
-
<nullable> _reference :Object
-
The actual target reference, or
null
if the reference has been already discarded.Type:
- Object
-
target
-
Returns the target reference, provided that the target reference is still alive. Returns
null
if the reference has been discarded.