(text)
| 322 | } |
| 323 | |
| 324 | function resolveText(text) { |
| 325 | const record = textCache.get(text); |
| 326 | if (record === undefined) { |
| 327 | const newRecord = { |
| 328 | status: 'resolved', |
| 329 | value: text, |
| 330 | }; |
| 331 | textCache.set(text, newRecord); |
| 332 | } else if (record.status === 'pending') { |
| 333 | const thenable = record.value; |
| 334 | record.status = 'resolved'; |
| 335 | record.value = text; |
| 336 | thenable.pings.forEach(t => t()); |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | function rejectText(text, error) { |
| 341 | const record = textCache.get(text); |