Skip to content

Commit

Permalink
compatibility: add globalThis if not defined. #86
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Apr 26, 2021
1 parent 086ff6c commit e61fd6f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ if (!ArrayBuffer.isView) {
return a !== null && typeof (a) === 'object' && a.buffer instanceof ArrayBuffer;
};
}

// Define globalThis if not available.
// https://github.com/colyseus/colyseus.js/issues/86
if (
typeof (globalThis) === "undefined" &&
typeof (window) !== "undefined"
) {
// @ts-ignore
window['globalThis'] = window;
}

0 comments on commit e61fd6f

Please sign in to comment.