add instrumentation
This commit is contained in:
parent
2dcc33f210
commit
5567fe37a6
2 changed files with 41 additions and 30 deletions
|
|
@ -28,7 +28,15 @@ const preloadImg = (src) => {
|
|||
return true;
|
||||
};
|
||||
|
||||
const loadImgElement = (url) => new Promise((resolve, reject) => {
|
||||
const image = new Image();
|
||||
image.onload = () => resolve(image);
|
||||
image.onerror = reject;
|
||||
image.src = url;
|
||||
});
|
||||
|
||||
export {
|
||||
loadImg,
|
||||
preloadImg,
|
||||
loadImgElement,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue