Fix navigator types issue
This commit is contained in:
@@ -37,7 +37,7 @@ export default async function load(fontFamily: string, cacheSize: number): Promi
|
|||||||
// Web environment that supports font access API
|
// Web environment that supports font access API
|
||||||
if (typeof navigator !== 'undefined' && 'fonts' in navigator) {
|
if (typeof navigator !== 'undefined' && 'fonts' in navigator) {
|
||||||
try {
|
try {
|
||||||
const status = await (navigator as IFontAccessNavigator).permissions.request?.({
|
const status = await (navigator as unknown as IFontAccessNavigator).permissions.request?.({
|
||||||
name: 'local-fonts'
|
name: 'local-fonts'
|
||||||
});
|
});
|
||||||
if (status && status.state !== 'granted') {
|
if (status && status.state !== 'granted') {
|
||||||
@@ -53,7 +53,7 @@ export default async function load(fontFamily: string, cacheSize: number): Promi
|
|||||||
}
|
}
|
||||||
const fonts: Record<string, IFontMetadata[]> = {};
|
const fonts: Record<string, IFontMetadata[]> = {};
|
||||||
try {
|
try {
|
||||||
const fontsIterator = await (navigator as IFontAccessNavigator).fonts.query();
|
const fontsIterator = await (navigator as unknown as IFontAccessNavigator).fonts.query();
|
||||||
for (const metadata of fontsIterator) {
|
for (const metadata of fontsIterator) {
|
||||||
if (!fonts.hasOwnProperty(metadata.family)) {
|
if (!fonts.hasOwnProperty(metadata.family)) {
|
||||||
fonts[metadata.family] = [];
|
fonts[metadata.family] = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user