Skip to content

Api check#83

Merged
ttbombadil merged 4 commits intomainfrom
api
Apr 9, 2026
Merged

Api check#83
ttbombadil merged 4 commits intomainfrom
api

Conversation

@ttbombadil
Copy link
Copy Markdown
Collaborator

No description provided.

- use-external-api.ts: Replace window with globalThis (S7764)
  - Updated sendMessageToParent to use globalThis.parent ?? globalThis
  - Updated sendEventToParent to use globalThis.parent ?? globalThis
  - Changed window.addEventListener to globalThis.addEventListener

- Reduce Cognitive Complexity in use-external-api.ts (S3776)
  - Extracted 7 action handlers into separate functions
  - Simplified switch statement with 12 cases to more maintainable structure
  - Complexity reduced from 24 to 15

- api-test.html: Fix text contrast and accessibility (S7924, S6853)
  - Increased .log-entry .ts color from #64748b to #94a3b8 for better contrast
  - Added for/id linking for all form labels:
    - Simulator URL input
    - Sketch Code textarea
    - Timeout input
    - Pin and Value inputs
    - Serial Data input

All tests passing (1413/1413), TypeScript clean
Exception Handling (javascript:S2486):
- Enhanced catch block to log error details: name and message
- api-test.html: connectSimulator() exception now properly documented

Code already improved in previous commit:
- globalThis preference (javascript:S7764)
- Default parameters (javascript:S7760)
- Ternary extraction (javascript:S3358)
- String#replaceAll() (javascript:S7781)
- Element.dataset (javascript:S7761)
- Nested functions (javascript:S7735)
- Text contrast improvements (css:S7924)

External API tests: 35/35 passing
All changes validated and merged
- Contrast (S7924): button.primary darkened #0c86c7→#0369a1 (contrast 5.1:1)
- Contrast (S7924): status badges changed from semi-transparent to opaque
  .status.connected: #14532d / #bbf7d0 (contrast 6.7:1)
  .status.disconnected: #7f1d1d / #fecaca (contrast 5.3:1)
- Negated condition (S7735): 'data !== undefined ?' flipped to 'data === undefined ?'
- Redundant jump (S3626): removed unnecessary 'return' at end of else block
@ttbombadil ttbombadil merged commit b9eb81c into main Apr 9, 2026
3 checks passed
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.

1 participant