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

Add Runtime.SetGlobalObject() method. #654

Merged
merged 1 commit into from
Jan 25, 2025
Merged

Conversation

Hakkin
Copy link
Contributor

@Hakkin Hakkin commented Jan 25, 2025

See #653 (comment).

I'm not sure if there should be more to go along with this, this bare minimum function makes sense in the above Proxy example, but if you're actually setting it to a new object rather than Proxying the old global, all the built-ins will be missing from the global scope. Maybe that is desirable in some situations, but maybe another function to initialize a "default" global object makes sense as well?

I added tests for all the cases that seemed notable, things like variables being defined/undefined in old/new global, and checking references to the old global in the new global scope. I also included a test for the original Proxy example to make sure it worked as expected.

@dop251 dop251 merged commit 12bd88c into dop251:master Jan 25, 2025
4 checks passed
@Hakkin Hakkin deleted the SetGlobalObject branch January 26, 2025 04:20
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.

2 participants