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

Adding IDKit.isInitialized Flag to Check Initialization Status #256

Closed
erados opened this issue Jun 27, 2024 · 1 comment
Closed

Adding IDKit.isInitialized Flag to Check Initialization Status #256

erados opened this issue Jun 27, 2024 · 1 comment

Comments

@erados
Copy link

erados commented Jun 27, 2024

Description:

Currently, the IDKit can only be initialized once. To ensure that the initialization process is managed correctly, it would be beneficial to have a flag indicating whether the IDKit has been initialized. This flag, IDKit.isInitialized, would help developers avoid reinitialization attempts and manage the initialization state more effectively.

Proposed Solution:

Introduce a boolean flag IDKit.isInitialized that:

  • Defaults to false before initialization.
  • Changes to true once the IDKit has been successfully initialized.

Benefits:

  1. Prevent Reinitialization: By checking the isInitialized flag, developers can avoid unnecessary or erroneous reinitialization attempts.
  2. State Management: Provides a clear and straightforward way to manage the initialization state within the application.
  3. Error Handling: Helps in implementing more robust error handling by checking the initialization state before performing operations that depend on IDKit.

Example Usage:

if (!IDKit.isInitialized) {
    IDKit.initialize();
}

// Safe to proceed with operations that require IDKit to be initialized
if (IDKit.isInitialized) {
    // Perform operations
}

Thank you for considering this enhancement. It would greatly improve the usability and reliability of the IDKit in various scenarios.

image

@Ivanciro27
Copy link

if (!IDKit.isInitialized) {
IDKit.initialize();
}

// Safe to proceed with operations that require IDKit to be initialized
if (IDKit.isInitialized) {
// Perform operations
}

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

No branches or pull requests

3 participants