Capítulo 371 de 988

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

  1. Understand example when working with watchPublicFolder().
  2. Understand arguments when working with watchPublicFolder().
  3. Understand callback when working with watchPublicFolder().
  4. 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.