Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/05/2021, 22:45
SLD
 
Fecha de Ingreso: diciembre-2013
Mensajes: 121
Antigüedad: 10 años, 4 meses
Puntos: 6
cómo pasar el valor de un "[object Promise]" a una variable?

Busco obtener TODAS las fuentes que el navegador tiene disponibles.

De NET tome éste código:
Código:
const getInstalledFonts = async () => {
	const { state } = await navigator.permissions.query({ name: "font-access" })
	if (state === "denied") {
		return []
		}
	const fonts = []
	try {
		for (const { family, fullName } of await navigator.fonts.query()) {
			fonts.push({ family, fullName })
			}
		} catch {}
	return fonts;
	}
que supuestamente retorna TODAS las fuentes del browser.

Pero no logro obtener la data:
Código:
function getFonts() {
	document.write('<pre>');
	Q = getInstalledFonts();
	document.write(Q);
	getInstalledFonts().then((fonts) => alert(fonts));
	}
</script>
<body onload="getFonts();">
Pueden indicarme cómo obtener la DATA por favor.

Gracias