我发现回调“on”很有趣,但限制了https://www.figma.com/plugin-docs/api/properties/figma-on/#docsNav
我有一种方法可以在文件更新后触发事件吗?
发布于 2020-11-28 00:07:21
目前没有办法做到这一点。唯一可以获得的更新类型是选择更改或当前页面更改。下面是一个示例从医生那里
figma.on("selectionchange", () => { console.log("changed") })插件通常用于监视节点上的更改的方法是轮询:简单地创建一个间隔或计时器,并检查其中一个属性是否更改了以前保存的状态。
let interval = setInterval(checkNodes, 500) // check every 300ms
const node = figma.currentPage.selection[0] // first node in selection
let nodeWidth = node.width // store node properties to watch
function checkNodes() {
if (nodeWidth !== node.width) {
// width changed
}
nodeWidth = node.width
}https://stackoverflow.com/questions/64850062
复制相似问题