Don't call posthog before its initialised

This commit is contained in:
David Baker 2023-04-05 15:00:14 +01:00
commit 5e4aa53997
2 changed files with 6 additions and 1 deletions

View file

@ -102,6 +102,10 @@ export class PosthogAnalytics {
private platformSuperProperties = {};
private registrationType: RegistrationType = RegistrationType.Guest;
public static hasInstance(): boolean {
return Boolean(this.internalInstance);
}
public static get instance(): PosthogAnalytics {
if (!this.internalInstance) {
this.internalInstance = new PosthogAnalytics(posthog);