Figma Support Forum

Can we get callback from setRangeTextStyleId?

Can we get a feedback from TextNode.setRangeTextStyleId() ?
Currently, that function returns nothing but the behavior is async.

Returning Promise will be nice.

What do you mean? Async functions always return a promise. You can do await node.setRangeTextStyleAsync() which I prefer but if you really have to, you can do node.setRangeTextStyleAsync().then(() => { /* do something after the promise */ }). All async functions return a promise.


Thank you for your reply!

node.setRangeTextStyleAsync is not an async function.

If I change textStyleId from this function, text style of actual node will change after a while.
AFAIK, I can’t get when the node’s visual is updated.

Sorry, I was completely wrong. Not sure where my brain got the setRangeTextStyleAsync function from. You can’t get when the node’s visual style is updated, however in code it should be updated instantly since the function is not async.