MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getNonce

Function getNonce

packages/react-aria/src/utils/getNonce.ts:28–38  ·  view source on GitHub ↗
(doc?: Document)

Source from the content-addressed store, hash-verified

26 * Security Policy.
27 */
28export function getNonce(doc?: Document): string | undefined {
29 let ownerDocument = getOwnerDocument(doc);
30
31 let nonce = nonceCache.get(ownerDocument);
32 nonce ??= getMetaValue('csp-nonce', ownerDocument);
33
34 if (nonce !== undefined) {
35 nonceCache.set(ownerDocument, nonce);
36 }
37 return nonce;
38}

Callers 3

getNonce.test.jsFile · 0.90
usePressFunction · 0.90

Calls 3

getOwnerDocumentFunction · 0.90
getMetaValueFunction · 0.90
setMethod · 0.45

Tested by

no test coverage detected