When is ValidateToolbarItem called?
miked1ck opened this issue · 2 comments
miked1ck commented
I'm having a hard time getting ValidateToolbarItem
to run:
Manifest.js
"handlers": {
"run": "openKit",
"ValidateToolbarItem": "validateToolbarItem"
}
my-command.js
export function validateToolbarItem(context) {
console.log('Hey!', context)
}
miked1ck commented
BTW, awesome plugin. Thank you for it!
abynim commented
Your implementation of validateToolbarItem
should be called by Sketch whenever it internally validates all toolbar items (for example, on selection change), but it does so only if the corresponding item is actually in the toolbar.
Please use this only if required though, since having to spawn a JS context on every selection change slows down Sketch quite a bit. I had added this feature to see if it was possible, but later realized that on slower machines it does cause a visible lag.