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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

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

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
2 participants