Skip to content

Commit 6e3f4d6

Browse files
committed
Use globalThis slots
1 parent 56df93f commit 6e3f4d6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/slots.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,12 @@ interface SlotsToTypes {
150150

151151
type SlotKey = keyof SlotsToTypes;
152152

153-
const slots = new WeakMap();
153+
const globalTemporalSlotMapKey = Symbol.for('@@Temporal__slots__private_do_not_use');
154+
155+
(globalThis as any)[globalTemporalSlotMapKey] ||= new WeakMap();
156+
157+
const slots = (globalThis as any)[globalTemporalSlotMapKey];
158+
154159
export function CreateSlots(container: AnyTemporalType): void {
155160
slots.set(container, Object.create(null));
156161
}

0 commit comments

Comments
 (0)