improve performance of getIconSize() (#10125)
* load icons once on module load
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import SVGPathCommander from 'svg-path-commander'
|
||||
import loadSimpleIcons from './load-simple-icons.js'
|
||||
|
||||
const simpleIcons = loadSimpleIcons()
|
||||
|
||||
function svg2base64(svg) {
|
||||
return `data:image/svg+xml;base64,${Buffer.from(svg.trim()).toString(
|
||||
'base64',
|
||||
@@ -8,8 +10,6 @@ function svg2base64(svg) {
|
||||
}
|
||||
|
||||
function getIconSize(iconKey) {
|
||||
const simpleIcons = loadSimpleIcons()
|
||||
|
||||
if (!(iconKey in simpleIcons)) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user