Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

ES2022 - Using whichever resource loads fastest

const resource = await Promise.any([
  fetch('http://example.com/first.txt')
    .then(response => response.text()),
  fetch('http://example.com/second.txt')
    .then(response => response.text()),
]);
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #Using #resource #loads #fastest
ADD COMMENT
Topic
Name
2+1 =