Capítulo 225 de 988

Chapter 225: prefetch()

Core Idea

_Available in v3. 2.

Key Concepts

  • API
  • src
  • options
  • method?<AvailableFrom v="3.2.35" />
  • contentType?<AvailableFrom v="4.0.40" />
  • credentials?<AvailableFrom v="4.0.229" />
  • onProgress?<AvailableFrom v="4.0.85" />
  • logLevel?<AvailableFrom v="4.0.250" />

Code Examples

const {free, waitUntilDone} = prefetch('https://example.com/video.mp4', {
  method: 'blob-url',
});

waitUntilDone().then(() => {
  console.log('Video has finished loading');
});

// Call free() if you want to un-prefetch and free up the memory:
free();
  • What it demonstrates: Usage pattern for prefetch() from the official docs.

Key Takeaways

  1. Understand api when working with prefetch().
  2. Understand src when working with prefetch().
  3. Understand options when working with prefetch().
  4. Understand method?<availablefrom v="3.2.35" /> when working with prefetch().
  5. Understand contenttype?<availablefrom v="4.0.40" /> when working with prefetch().

Connects To

  • Animatedimage: related page in the Assets & Media section.
  • Delaying: related page in the Assets & Media section.
  • Exporting: related page in the Assets & Media section.