Chapter 371: watchPublicFolder()
Core Idea
Watches for changes in the public directory and calls a callback function when a file is added, removed or modified.
Key Concepts
- Example
- Arguments
- callback
- See also
Code Examples
// Watch for changes in a specific static file
const { cancel } = watchPublicFolder((newFiles: StaticFile[]) => {
console.log("The public folder now contains:", newFiles);
});
// To stop watching for changes, call the cancel function
cancel();
- What it demonstrates: Usage pattern for watchPublicFolder() from the official docs.
Key Takeaways
- Understand example when working with watchPublicFolder().
- Understand arguments when working with watchPublicFolder().
- Understand callback when working with watchPublicFolder().
- Understand see also when working with watchPublicFolder().
Connects To
- Clipper: related page in the Studio, Player & Editing section.
- Design Systems: related page in the Studio, Player & Editing section.
- Editor Starter: related page in the Studio, Player & Editing section.