Skip to content

Commit

Permalink
[docs] Update consent README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky authored Oct 3, 2023
1 parent 5ac4ef6 commit 4ca56fb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/consent/consent-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createWrapper, resolveWhen } from '@segment/analytics-consent-tools'
export const withCMP = createWrapper({

// Wrapper waits to load segment / get categories until this function returns / resolves
shouldLoad: (ctx) => {
shouldLoad: async (ctx) => {
const CMP = await getCMP()
await resolveWhen(
() => !CMP.popUpVisible(),
Expand All @@ -24,12 +24,12 @@ export const withCMP = createWrapper({
}
},

getCategories: () => {
getCategories: async () => {
const CMP = await getCMP()
return normalizeCategories(CMP.consentedCategories()) // Expected format: { foo: true, bar: false }
},

registerOnConsentChanged: (setCategories) => {
registerOnConsentChanged: async (setCategories) => {
const CMP = await getCMP()
CMP.onConsentChanged((event) => {
setCategories(normalizeCategories(event.detail))
Expand Down

0 comments on commit 4ca56fb

Please sign in to comment.