JSFiddle - React, Tailwind, and code Playground

by aliaksej

JavaScript

var image;
function onload () {
    console.log(image.height, image.width);
}

image= new Image();
image.src="https://www.google.com/intl/en_com/images/srpr/logo3w.png";
// check if image is already loaded to cache
if (image.complete) {
    console.log('image already loaded to browser');
    onload();
} else {
    // or bind onload handler for image
    image.onload = onload;
}