Skip to main content

off

Removes a callback added with figma.on or figma.once.

Signature

off(type: ArgFreeEventType, callback: () => void): void

off(type: 'run', callback: (event: RunEvent) => void): void

off(type: 'drop', callback: (event: DropEvent) => boolean): void

Remarks

The callback needs to be the same object that was originally added. For example, you can do this:

Correct way to remove a callback
let fn = () => { console.log("selectionchanged") }
figma.on("selectionchange", fn)
figma.off("selectionchange", fn)

whereas the following won't work, because the function objects are different:

Incorrect way to remove a callback
figma.on("selectionchange", () => { console.log("selectionchanged") })
figma.off("selectionchange", () => { console.log("selectionchanged") })

On this page