Skip to content

Commit

Permalink
Support globalThis in getGlobal() for better compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
simonihmig committed Nov 15, 2021
1 parent 71298ef commit 0d51d33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-jokes-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'xstate': patch
---

Support `globalThis` in `getGlobal()` for better compatibility
3 changes: 3 additions & 0 deletions packages/core/src/devTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export interface XStateDevInterface {

// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
export function getGlobal() {
if (typeof globalThis !== 'undefined') {
return globalThis;
}
if (typeof self !== 'undefined') {
return self;
}
Expand Down

0 comments on commit 0d51d33

Please sign in to comment.