Skip to content
New issue

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

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

Already on GitHub? # to your account

all apps: refactor global. -> globalThis. #3763

Closed
wants to merge 1 commit into from

Conversation

thyttan
Copy link
Collaborator

@thyttan thyttan commented Feb 26, 2025

As per:
global is used in Node.js. Consider using the identical globalThis as it was introduced in the ECMAScript spec.

If we decide it's worth merging this we should probably bump versions of the apps as well?

@bobrippling @gfwilliams Does this make sense?

As per:
[global is used in Node.js. Consider using the identical globalThis as it was introduced in the ECMAScript spec.](https://www.espruino.com/ReferenceBANGLEJS2#l__global_global)

If we decide it's worth merging this we should probably bump versions of
the apps as well?
@gfwilliams
Copy link
Member

Thanks, but I'm not really sure if this adds anything? It'll make all these apps very slightly larger and slower and introduces the possibility of breakage.

But otherwise it's not fixing anything, just following what the ECMA spec team randomly changed. Looking at Node.js specs it says Stability: 3 which means they have no plans to get rid of global so it's not like this JS code is going to be un-runnable in other JS engines if we keep global.

... perhaps the wording in global in the docs should be changed actually?

@thyttan
Copy link
Collaborator Author

thyttan commented Feb 27, 2025

... perhaps the wording in global in the docs should be changed actually?

Yes that makes sense to me in that case 👍

gfwilliams added a commit to espruino/Espruino that referenced this pull request Feb 27, 2025
@thyttan thyttan closed this Feb 27, 2025
@thyttan thyttan deleted the globalThis-refactor branch February 27, 2025 17:19
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants