Skip to content

Commit 663f3e9

Browse files
author
alikn
authored
[Performance] do not access window before initialization (#2003)
* [Performance] do not access window before initialization
1 parent 59d5bca commit 663f3e9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/performance/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export function registerPerformance(instance: FirebaseNamespace): void {
3636
if (app.name !== DEFAULT_ENTRY_NAME) {
3737
throw ERROR_FACTORY.create(ErrorCode.FB_NOT_DEFAULT);
3838
}
39+
if (typeof window === 'undefined') {
40+
throw ERROR_FACTORY.create(ErrorCode.NO_WINDOW);
41+
}
42+
setupApi(window);
3943
SettingsService.getInstance().firebaseAppInstance = app;
4044
return new PerformanceController(app);
4145
};
@@ -49,7 +53,6 @@ export function registerPerformance(instance: FirebaseNamespace): void {
4953
);
5054
}
5155

52-
setupApi(window);
5356
registerPerformance(firebase);
5457

5558
declare module '@firebase/app-types' {

0 commit comments

Comments
 (0)