Skip to content

Commit 47904cb

Browse files
committed
Wait for analytic to be ready before returning the opt functions
1 parent 6ffc061 commit 47904cb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/eulerianAnalytics.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,16 @@ export async function startEulerianAnalytics(params: EulerianAnalyticsParams) {
7979
// @ts-expect-error
8080
await import("./dsfr/analytics/analytics.module.min");
8181

82+
//@ts-expect-error
83+
await dsfr.analytics.readiness;
84+
8285
return {
83-
// @ts-expect-error
8486
"enable": () => {
87+
// @ts-expect-error
8588
window.dsfr.analytics.opt.enable();
8689
},
87-
// @ts-expect-error
8890
"disable": () => {
91+
// @ts-expect-error
8992
window.dsfr.analytics.opt.disable();
9093
}
9194
};

0 commit comments

Comments
 (0)