Skip to content

test(ts-browser): use globalThis instead of window#2277

Open
fewerner wants to merge 4 commits into
mainfrom
felix/ts-browser/avoid-window
Open

test(ts-browser): use globalThis instead of window#2277
fewerner wants to merge 4 commits into
mainfrom
felix/ts-browser/avoid-window

Conversation

@fewerner

Copy link
Copy Markdown
Contributor

What's new in this PR

This PR declares window variables as globals and avoids accessing them via window.


PR Submission Checklist for internal contributors
  • The PR Title
    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

fewerner added 4 commits June 23, 2026 15:30
By declaring helpers and ccModule as global fields we don't have to
access them via window.
`Window` holds the same fields as `GlobalThis`. It is defined as:

```typescript
declare var window: Window & typeof globalThis;
```

GlobalThis works on browser and node. We can access all global
definitions directly, via globalThis, and window in browser.
Instead we just access global fields directly.
This is a purely mechanical change.
First access of globals without using globalThis results in errors.
I assume that the first access creates a runtime binding that on
following calls resolves fine without using globalThis.
Less globals is better. We can just use the getter from our API instead.
@fewerner fewerner marked this pull request as ready for review June 23, 2026 14:11
@fewerner fewerner requested a review from a team June 23, 2026 14:11
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