Files
Website/resources/js/helpers/image.ts
2023-02-20 10:20:12 +10:00

15 lines
301 B
TypeScript

type ImageLoadCallback = (url: string) => void;
export const imageLoad = (
url: string,
callback: ImageLoadCallback,
postfix = "h=50"
) => {
callback(`${url}?${postfix}`);
const tmp = new Image();
tmp.onload = function () {
callback(url);
};
tmp.src = url;
};