chore: polish some components

This commit is contained in:
2023-12-30 09:02:39 +07:00
parent 55d6318614
commit ddbbcf41b5
11 changed files with 44 additions and 28 deletions

View File

@@ -6,3 +6,4 @@ export * from "./src/notification";
export * from "./src/hooks/useNetworkStatus";
export * from "./src/hooks/useOpenGraph";
export * from "./src/cn";
export * from "./src/image";

View File

@@ -0,0 +1,10 @@
export function getImageMeta(
url: string,
): Promise<{ width: number; height: number }> {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(img);
img.onerror = () => reject();
img.src = url;
});
}