Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using Array constructor as a global namespace in @wry/context #359

Merged
merged 2 commits into from
Aug 12, 2022

Conversation

benjamn
Copy link
Owner

@benjamn benjamn commented Aug 12, 2022

Fixes issue #347 by preferring globalThis[globalKey] and global[globalKey] (in that order) as the storage location for a singleton copy of the Slot class, instead of using Array[globalKey], which was the source of issue #347.

In this new implementation, while Array[globalKey] is consulted for backwards compatibility with simultaneously installed older versions of the @wry/context package (unlikely but possible), the Array constructor is no longer modified in any way.

@benjamn benjamn force-pushed the issue-347-avoid-using-Array-constructor-as-namespace branch from e3ccac3 to b2a0db3 Compare August 12, 2022 20:30
@benjamn benjamn changed the title Issue 347 avoid using array constructor as namespace Avoid using Array constructor as a global namespace Aug 12, 2022
@benjamn benjamn self-assigned this Aug 12, 2022
@benjamn benjamn changed the title Avoid using Array constructor as a global namespace Avoid using Array constructor as a global namespace in @wry/context Aug 12, 2022
@benjamn benjamn force-pushed the issue-347-avoid-using-Array-constructor-as-namespace branch 2 times, most recently from 77306c7 to 237aff5 Compare August 12, 2022 20:36
@benjamn benjamn linked an issue Aug 12, 2022 that may be closed by this pull request
@benjamn benjamn merged commit 2ff21a0 into main Aug 12, 2022
@benjamn benjamn deleted the issue-347-avoid-using-Array-constructor-as-namespace branch August 12, 2022 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use globalThis when available rather than using Array as a namespace
1 participant