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
- Understand api when working with prefetch().
- Understand src when working with prefetch().
- Understand options when working with prefetch().
- Understand method?<availablefrom v="3.2.35" /> when working with prefetch().
- 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.