MCPcopy Create free account
hub / github.com/ampproject/amphtml / getConsentPolicyState

Function getConsentPolicyState

src/consent.js:10–19  ·  view source on GitHub ↗
(element, policyId = 'default')

Source from the content-addressed store, hash-verified

8 * @return {!Promise<import('#core/constants/consent-state').CONSENT_POLICY_STATE|null>}
9 */
10export function getConsentPolicyState(element, policyId = 'default') {
11 return Services.consentPolicyServiceForDocOrNull(element).then(
12 (consentPolicy) => {
13 if (!consentPolicy) {
14 return null;
15 }
16 return consentPolicy.whenPolicyResolved(/** @type {string} */ (policyId));
17 }
18 );
19}
20
21/**
22 * Returns a promise that resolves to a sharedData retrieved from consent

Callers 15

getConsentStateMethod · 0.90
getConsentInfoMethod · 0.90
getConsentData_Method · 0.90
initiateAdRequestMethod · 0.90
getConsentDataFunction · 0.90
getConsentStateStrFunction · 0.90
sendConsentData_Method · 0.90
initMethod · 0.90
getConsents_Method · 0.90
bindToAmpConsent_Method · 0.90

Calls 2

whenPolicyResolvedMethod · 0.80
thenMethod · 0.45

Tested by

no test coverage detected