chore: polish some components
This commit is contained in:
@@ -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";
|
||||
|
||||
10
packages/utils/src/image.ts
Normal file
10
packages/utils/src/image.ts
Normal 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;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user