Files
cell/docs/dull/WeakSet.md
2025-02-10 09:48:59 -06:00

44 lines
903 B
Markdown

# WeakSet
A WeakSet object is a collection of unique objects (no primitive values).
References to objects in a WeakSet are held weakly, so they do not prevent
garbage collection if there are no other references to the object. WeakSet
elements are not iterable.
### add(value) <sub>function</sub>
Add a new object to the WeakSet if it is not already present. The value
must be an object.
**value**: The object to add.
**Returns**: The WeakSet object (for chaining).
### has(value) <sub>function</sub>
Return a boolean indicating whether an object is present in the WeakSet.
**value**: The object to check.
**Returns**: True if the object is in the WeakSet, otherwise false.
### delete(value) <sub>function</sub>
Remove the specified object from the WeakSet, if it exists.
**value**: The object to remove.
**Returns**: True if the object was present and removed, otherwise false.