@@ -87,11 +87,15 @@ export class ConsentManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let instance: ConsentManager | null = null;
|
const GLOBAL_KEY = "__proboConsentManager";
|
||||||
|
|
||||||
export function getConsent(): ConsentManager {
|
export function getConsent(): ConsentManager {
|
||||||
if (!instance) {
|
const g = typeof globalThis !== "undefined"
|
||||||
instance = new ConsentManager();
|
? (globalThis as unknown as Record<string, unknown>)
|
||||||
|
: (window as unknown as Record<string, unknown>);
|
||||||
|
|
||||||
|
if (!g[GLOBAL_KEY]) {
|
||||||
|
g[GLOBAL_KEY] = new ConsentManager();
|
||||||
}
|
}
|
||||||
return instance;
|
return g[GLOBAL_KEY] as ConsentManager;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user