Skip to content

Conversation

@timfish
Copy link
Collaborator

@timfish timfish commented Sep 27, 2022

#5821 ended up being a rather huge PR so this is the first of many PRs that makes these changes per package. For now we keep the getGlobalObject() implementation until all the packages are migrated.

As discussed here, this PR:

  • Replaces getGlobalObject with a const GLOBAL_OBJ which retains the runtime detection from feat(utils): Modern implementation of getGlobalObject #5809
    • Improvement over before since we only evaluate the detection code once
    • No need to lazily evaluate since GLOBAL_OBJ is always accessed
  • Also includes a WINDOW const which returns GLOBAL_OBJ but with typeof GLOBAL_OBJ & Window type.
    • This will eventually move to @sentry/browser to ensure stricter typing around the global object
    • Maybe this should be called WINDOW_GLOBAL to remove any ambiguity?

extensions?: {
/** Extension methods for the hub, which are bound to the current Hub instance */
// eslint-disable-next-line @typescript-eslint/ban-types
[key: string]: Function;
Copy link
Member

Choose a reason for hiding this comment

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

We should probably type this stricter, but we can do that after we are done with all of the changes.

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