Skip to content

Commit

Permalink
Non dom environment (#369)
Browse files Browse the repository at this point in the history
* check dom variables in server side environment

* update changelog type check (#334)

* simplification of the test for the existence of the property

* test if window.document is defined
  • Loading branch information
lhapaipai authored Sep 27, 2021
1 parent 0b7d383 commit 3c78cdc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

- Fix warning due to strict comparison of SDF property in image sprite (#303)
- Fix tile placeholder replacement to allow for placeholders to be in a URL more than once. (#348)
- Fix type check for non dom environment. (#334)

## 1.15.2

Expand Down
2 changes: 1 addition & 1 deletion src/util/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const exported = {
return linkEl.href;
},

hardwareConcurrency: navigator && navigator.hardwareConcurrency || 4,
hardwareConcurrency: typeof navigator !== 'undefined' && navigator.hardwareConcurrency || 4,

get prefersReducedMotion(): boolean {
if (!matchMedia) return false;
Expand Down
2 changes: 1 addition & 1 deletion src/util/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Point from './point';
import assert from 'assert';

export default class DOM {
private static readonly docStyle = window.document && window.document.documentElement.style;
private static readonly docStyle = typeof window !== 'undefined' && window.document && window.document.documentElement.style;

private static userSelect: string;

Expand Down

0 comments on commit 3c78cdc

Please sign in to comment.