watchPublicFolder()v4.0.154
监视public directory中的更改,并在添加、删除或修改文件时调用回调函数。
note
此功能仅在 Remotion Studio 环境中可用。在 Player 中,事件永远不会触发。
示例
example.tsxtsx
import {StaticFile ,watchPublicFolder } from "@remotion/studio";// Watch for changes in a specific static fileconst {cancel } =watchPublicFolder ((newFiles :StaticFile []) => {console .log ("The public folder now contains:",newFiles );});// To stop watching for changes, call the cancel functioncancel ();
example.tsxtsx
import {StaticFile ,watchPublicFolder } from "@remotion/studio";// Watch for changes in a specific static fileconst {cancel } =watchPublicFolder ((newFiles :StaticFile []) => {console .log ("The public folder now contains:",newFiles );});// To stop watching for changes, call the cancel functioncancel ();
参数
接受一个参数并返回一个可用于cancel
事件监听器的函数。
callback
当目录被修改时将调用的回调函数。作为参数传递一个StaticFile
数组。