Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

resource loads fastest

// ES2022
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: #resource #loads #fastest
ADD COMMENT
Topic
Name
2+8 =