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

refactor: Use static Lazy instance for all sensors #19275

Conversation

nickodei
Copy link
Contributor

GitHub Issue (If applicable): closes #19274

PR Type

What kind of change does this PR introduce?

  • Refactoring (no functional changes, no api changes)

What is the current behavior?

Most sensor classes use a static instance and track with an boolean if the instance is already created. This caused code duplication and wasn't implemented like the LightSensor.cs implementation.

What is the new behavior?

Use a static Lazy instance for instance creation, which removes the object lock, as well as the boolean. This follows the implementation already in LightSensor.cs.

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

@github-actions github-actions bot added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform labels Jan 18, 2025
@nickodei nickodei marked this pull request as draft January 18, 2025 19:06
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-19275/index.html

@nickodei nickodei closed this Jan 19, 2025
@nickodei nickodei force-pushed the use-lazy-instance-for-all-sensor-classes branch from c1f2bfe to 4c8b326 Compare January 19, 2025 13:14
@nickodei
Copy link
Contributor Author

Okay, I f'd up this one. Because I force pushed the branch without any changes, GitHub decided to close the issue for me and I cant commit anything anymore. I opened a new PR: #19278. Sorry for the inconvenience.

@MartinZikmund
Copy link
Member

@nickodei no problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Lazy for instance creation on sensor classes
3 participants