Skip to content

chore: improve example app for more easy testing#321

Open
duyhungtnn wants to merge 2 commits intomainfrom
chore/update-example-to-test-uuid
Open

chore: improve example app for more easy testing#321
duyhungtnn wants to merge 2 commits intomainfrom
chore/update-example-to-test-uuid

Conversation

@duyhungtnn
Copy link
Copy Markdown
Collaborator

@duyhungtnn duyhungtnn commented Apr 29, 2026

I used this updated example app for manual test this changes #320

Screenshot 2026-04-29 at 15 01 38

This PR enhances the example app's UI and improves the initialization and teardown flow for the BKTClient integration. It adds explicit "Initialize" and "Destroy" controls, improves button state management, and enhances log output for better clarity during testing.

UI Improvements

  • Added "Initialize" and "Destroy" buttons to the UI, grouped separately from other controls, and improved the styling of the logs area for better readability.

Initialization & Teardown Flow

  • Refactored the client lifecycle: initialization and destruction are now handled by dedicated functions (handleInit and handleDestroy) tied to the new buttons. Button states are updated to prevent invalid actions. [1] [2]
  • Added an option for automatic initialization via the AUTO_INIT_FLAG, with log feedback if auto-init is disabled. [1] [2]

Logging Enhancements

  • Log messages now include timestamps and automatically scroll to the latest entry for easier debugging.

Type Safety and Code Cleanup

  • Added explicit type assertions for button elements to ensure type safety and reduce potential runtime errors.

Event Handling Improvements

  • Ensured that event listeners for evaluation updates are properly registered and removed during initialization and teardown, preventing memory leaks.

Revamp the example app to provide explicit Initialize/Destroy controls and improve logging and lifecycle handling. HTML: add Initialize and Destroy buttons, reorganize layout, and enhance the logs pane styling. TS: add AUTO_INIT_FLAG, stronger typings for button elements, timestamped logs, updateButtons helper, and new handleInit/handleDestroy flows that initialize/destroy the BKT client, register/remove evaluation update listeners, and update UI state. Also improve flush/user-attribute messages, move initialization behind the init handler (with optional auto-init), and ensure cleanup runs on beforeunload.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the example app to make manual testing of the BKTClient lifecycle clearer by adding explicit Initialize/Destroy controls, improving log output, and refining button enable/disable behavior.

Changes:

  • Added Initialize/Destroy buttons and reorganized the example UI layout.
  • Refactored the example’s BKTClient lifecycle into handleInit / handleDestroy, including evaluation update listener wiring.
  • Enhanced logging with timestamps and auto-scroll.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
example/index.ts Adds init/destroy handlers, button state updates, timestamped logs, and listener lifecycle management.
example/index.html Adds init/destroy buttons, groups controls, and improves logs container styling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread example/index.ts Outdated
Comment thread example/index.ts Outdated
Comment thread example/index.html Outdated
Comment thread example/index.ts Outdated
Comment thread example/index.ts
Comment thread example/index.ts
Comment thread example/index.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread example/index.ts
Comment thread example/index.ts
Comment thread example/index.ts
Comment thread example/index.ts
Comment thread example/index.html
@duyhungtnn duyhungtnn marked this pull request as ready for review April 29, 2026 08:02
@duyhungtnn duyhungtnn requested a review from cre8ivejp April 29, 2026 08:03
@duyhungtnn duyhungtnn changed the title chore: add init/destroy UI and improve example flow chore: improve example app for more easy testing Apr 29, 2026
@duyhungtnn
Copy link
Copy Markdown
Collaborator Author

@cre8ivejp please help me to take a look

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