Skip to content

Commit f9924e4

Browse files
authored
fix: improved browser compatibility around globalThis (#264)
Co-authored-by: sai cb <143211648+saivann-coinbase@users.noreply.github.com>
1 parent 8a56c8e commit f9924e4

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 9.4.1 (2024-6-03)
4+
5+
* **fix**: Improve browser compatibility around globalThis.
6+
37
## 9.4.0 (2024-4-22)
48

59
* **fix**: Fix import crash under node.js

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "perfume.js",
3-
"version": "9.4.0",
3+
"version": "9.4.1",
44
"description": "Web performance library for measuring all User-centric performance metrics, including the latest Web Vitals.",
55
"keywords": [
66
"performance",

Diff for: src/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Have private variable outside the class,
22
// helps drastically reduce the library size
3-
export const W = globalThis;
3+
export const W = typeof window !== 'undefined' ? window : {} as typeof window;
44
export const C = W.console;
55
export const WN = W.navigator;
66
export const WP = W.performance;

Diff for: src/initPerfume.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Perfume.js v9.4.0 (http://zizzamia.github.io/perfume)
2+
* Perfume.js v9.4.1 (http://zizzamia.github.io/perfume)
33
* Copyright 2022 Leonardo Zizzamia (https://github.com/Zizzamia/perfume.js/graphs/contributors)
44
* Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE)
55
*

0 commit comments

Comments
 (0)