Skip to main content

Hi,


in the plugin API,

at initialization, i’m loading fonts with loadFontAsync this way


await figma.loadFontAsync({ family: "Baloo Paaji 2", style: "Medium" });
await figma.loadFontAsync({ family: "Baloo Paaji 2", style: "Regular" });
//about 10 loads like this one

is there a faster way to do a bulk load, something where i would pass all the parameters at once in an array ?


Thanks in advance.

You can use await promise.all instead of multiple awaits


Thanks,


it does seems faster,

before, with all the awaits, it caused the hot reload to have weird behaviour, forcing me to focus on the Figma windows 2-3 times before the plugin could run.


It seems to be fixed now.

Here’s my code if anyone needs this


Promise.all(l
figma.loadFontAsync({ family: "Roboto Condensed", style: "Bold" }),
figma.loadFontAsync({ family: "Roboto", style: "Italic" }),
//load a bunch of fonts...
])
.then(res => {
//code to be executed after the font loading
});

Reply