Skip to content

Commit

Permalink
fix: fix window incompatibility problem (#3070)
Browse files Browse the repository at this point in the history
  • Loading branch information
NewByVector authored Dec 20, 2022
1 parent 2d04848 commit d8e1e63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/x6-common/src/polyfill/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// compatible with NodeList.prototype.forEach() before chrome 51
// https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach
if (window.NodeList && !NodeList.prototype.forEach) {
if (
typeof window === 'object' &&
window.NodeList &&
!NodeList.prototype.forEach
) {
NodeList.prototype.forEach = Array.prototype.forEach as any
}

Expand Down

0 comments on commit d8e1e63

Please sign in to comment.