MCPcopy
hub / github.com/facebook/react / resolveText

Function resolveText

packages/react-dom/src/__tests__/ReactDOMForm-test.js:90–104  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

88 });
89
90 function resolveText(text) {
91 const record = textCache.get(text);
92 if (record === undefined) {
93 const newRecord = {
94 status: 'resolved',
95 value: text,
96 };
97 textCache.set(text, newRecord);
98 } else if (record.status === 'pending') {
99 const thenable = record.value;
100 record.status = 'resolved';
101 record.value = text;
102 thenable.pings.forEach(t => t(text));
103 }
104 }
105
106 function readText(text) {
107 const record = textCache.get(text);

Calls 4

setMethod · 0.80
getMethod · 0.65
forEachMethod · 0.65
tFunction · 0.50

Tested by

no test coverage detected